Skip to content

Commit 358446c

Browse files
committed
ci: Build Actions for Sample Projects
1 parent 1b86f43 commit 358446c

27 files changed

Lines changed: 363 additions & 27 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Builds the sample projects on multiple targets to check for compiler errors.
2+
3+
name: Build Samples
4+
5+
on:
6+
#push:
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
os: [windows-latest, ubuntu-latest, macos-latest]
15+
target: [cpp, html5, hl]
16+
fail-fast: false
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- uses: actions/checkout@v6.0.2
22+
23+
- name: Setup Haxe
24+
uses: FunkinCrew/ci-haxe@v3
25+
with:
26+
haxe-version: 4.3.7
27+
28+
- name: Setup HMM
29+
run: |
30+
haxelib --global --quiet --never update haxelib
31+
haxelib --global fixrepo
32+
haxelib --global --quiet install hmm
33+
haxelib --global run hmm setup
34+
35+
- name: Install sample dependencies
36+
working-directory: ./samples
37+
run: |
38+
haxe run.hxml
39+
hmm install --quiet
40+
haxelib fixrepo
41+
42+
- name: Build Flixel Sample
43+
working-directory: ./samples/flixel
44+
run: |
45+
haxelib run lime build ${{ matrix.target }} --no-output
46+
47+
- name: Build ZIP Flixel Sample
48+
working-directory: ./samples/flixel_zip
49+
run: |
50+
haxelib run lime build ${{ matrix.target }} --no-output
51+
52+
- name: Build Heaps Sample
53+
if: matrix.target == 'hl'
54+
working-directory: ./samples/heaps
55+
run: |
56+
haxe hl.hxml
57+
58+
# - name: Build NME Sample
59+
# if: matrix.target != 'hl'
60+
# working-directory: ./samples/nme
61+
# run: |
62+
# hmm install --quiet
63+
# haxelib update
64+
# echo y | haxelib run nme build ${{ matrix.target }}
65+
66+
- name: Build OpenFL Sample
67+
working-directory: ./samples/openfl
68+
run: |
69+
haxelib run openfl build ${{ matrix.target }} --no-output
70+
71+
- name: Build OpenFL (Firetongue) Sample
72+
working-directory: ./samples/openfl_firetongue
73+
run: |
74+
haxelib run openfl build ${{ matrix.target }} --no-output
75+
76+
- name: Build OpenFL (HScript) Sample
77+
working-directory: ./samples/openfl_hscript
78+
run: |
79+
haxelib run openfl build ${{ matrix.target }} --no-output
80+
81+
- name: Build OpenFL (HScript with Classes) Sample
82+
working-directory: ./samples/openfl_hscript_class
83+
run: |
84+
haxelib run openfl build ${{ matrix.target }} --no-output
85+
86+

include.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<project>
33
<!-- These values are added to the project XML when you include this library. -->
4+
<haxelib name="jsonpath" />
5+
<haxelib name="jsonpatch" />
6+
<haxelib name="thx.core" />
47
<haxelib name="thx.semver" />
58

69
<haxeflag name="--macro" value="polymod.hscript._internal.HScriptRedirectDefines.run()" if="POLYMOD_REDIRECT_HSCRIPT" />

polymod/Polymod.hx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ class Polymod
851851
}
852852
}
853853

854+
#if lime
854855
/**
855856
* Get a list of all the available scripted classes (`.hxc` files), interpret them asynchronously, and register any classes.
856857
* Called on platforms that don't support synchronous file access.
@@ -889,6 +890,12 @@ class Polymod
889890

890891
return futures;
891892
}
893+
#else
894+
public static function registerAllScriptClassesAsync()
895+
{
896+
throw 'Function not supported on current target';
897+
}
898+
#end
892899

893900
/**
894901
* Dispatch an error message with the severity `PolymodErrorType.ERROR`.

polymod/backends/HEAPSBackend.hx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ class HEAPSBackend implements IBackend
102102
throw 'Function not implemented';
103103
}
104104

105+
public function listLibraries():Array<String>
106+
{
107+
throw 'Function not implemented';
108+
}
109+
105110
public function getPath(id:String):String
106111
{
107112
throw 'Function not implemented';
@@ -293,16 +298,16 @@ class ModFileEntry extends BytesFileEntry
293298
return super.getBytes();
294299
}
295300

296-
override function readByte():Int
301+
override function readBytes(out:Bytes, outPos:Int, pos:Int, len:Int):Int
297302
{
298303
initBytes();
299-
return super.readByte();
304+
return super.readBytes(out, outPos, pos, len);
300305
}
301306

302-
override function read(out:Bytes, pos:Int, size:Int)
307+
override function readFull(bytes:Bytes, pos:Int, len:Int)
303308
{
304309
initBytes();
305-
return super.read(out, pos, size);
310+
return super.readFull(bytes, pos, len);
306311
}
307312

308313
override function loadBitmap(onLoaded:LoadedBitmap->Void):Void

polymod/backends/LimeBackend.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package polymod.backends;
22

3-
import lime.system.ThreadPool;
43
import polymod.backends.PolymodAssetLibrary;
54
import polymod.backends.PolymodAssets.PolymodAssetType;
65
import polymod.fs.PolymodFileSystem;
@@ -18,6 +17,7 @@ import unifill.Unifill;
1817
import lime.app.Future;
1918
import lime.graphics.Image;
2019
import lime.net.HTTPRequest;
20+
import lime.system.ThreadPool;
2121
import lime.text.Font;
2222
import lime.utils.Assets;
2323
import lime.utils.Bytes;

polymod/backends/NMEBackend.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ class NMEBackend implements IBackend
165165
throw 'Function not implemented';
166166
}
167167

168+
public function listLibraries():Array<String>
169+
{
170+
throw 'Function not implemented';
171+
}
172+
168173
public function getPath(id:String):String
169174
{
170175
throw 'Function not implemented';

polymod/backends/PolymodAssetLibrary.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ class PolymodAssetLibrary
652652
typeLibraries.get('default').push(f);
653653
}
654654

655-
#if openfl
655+
#if (openfl && !nme)
656656
if (assetType == FONT)
657657
{
658658
var fontBytes = fileSystem.getFileBytes(file(f, d));
@@ -713,7 +713,7 @@ class PolymodAssetLibrary
713713
type.set(f, assetType);
714714
if (!typeLibraries.exists(libraryId)) typeLibraries.set(libraryId, []);
715715
typeLibraries.get(libraryId).push(f);
716-
#if openfl
716+
#if (openfl && !nme)
717717
if (assetType == FONT)
718718
{
719719
var fontBytes = fileSystem.getFileBytes(file(f, redirectPath));

polymod/fs/MemoryZipFileSystem.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class MemoryZipFileSystem extends StubFileSystem
1616
public function new(params:ZipFileSystemParams)
1717
{
1818
super(params);
19-
Polymod.error(FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5");
19+
Polymod.error(POLYMOD_FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5");
2020
}
2121

2222
public function addZipFile(zipName:String, zipBytes:Bytes)
2323
{
24-
Polymod.error(FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5");
24+
Polymod.error(POLYMOD_FUNCTIONALITY_NOT_IMPLEMENTED, "This file system not supported for this platform, and is only intended for use in html5");
2525
}
2626
}
2727
#else

polymod/hscript/_internal/PolymodScriptClass.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class PolymodScriptClass
183183
}
184184
}
185185

186+
#if lime
186187
static function registerScriptClassByPathAsync(path:String):lime.app.Future<Bool>
187188
{
188189
var promise = new lime.app.Promise<Bool>();
@@ -231,6 +232,7 @@ class PolymodScriptClass
231232
// Await the promise
232233
return promise.future;
233234
}
235+
#end
234236

235237
/**
236238
* Returns a list of all registered classes.

samples/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.haxelib
2+
hmm.json

0 commit comments

Comments
 (0)