Skip to content

Commit 72595c7

Browse files
committed
ci update
1 parent c353bd6 commit 72595c7

4 files changed

Lines changed: 29 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ jobs:
162162
- name: Check artifact
163163
shell: bash
164164
run: |
165-
mkdir ./plugins/ecso/cmxs/hx-4.3.7
166-
mv -T ./plugins/ecso/cmxs/Windows ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}
167-
cygcheck ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}/plugin.cmxs
168165
ls out
169166
# Output should contain binaries zip, installer zip and nupkg
170167
[ $(ls -1 out | wc -l) -eq "3" ]
@@ -320,9 +317,6 @@ jobs:
320317
- name: Check artifact
321318
shell: bash
322319
run: |
323-
mkdir ./plugins/ecso/cmxs/hx-4.3.7
324-
mv -T ./plugins/ecso/cmxs/Windows ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}
325-
cygcheck ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}/plugin.cmxs
326320
ls out
327321
# Output should contain binaries zip, installer zip and nupkg
328322
[ $(ls -1 out | wc -l) -eq "3" ]
@@ -395,7 +389,7 @@ jobs:
395389
run: |
396390
set -ex
397391
sudo apt-get update -qqy
398-
sudo apt-get install -qqy darcs bubblewrap ocaml-nox libpcre2-dev zlib1g-dev libgtk2.0-dev libmbedtls-dev ninja-build libstring-shellquote-perl libipc-system-simple-perl
392+
sudo apt-get install -qqy bubblewrap ocaml-nox libpcre2-dev zlib1g-dev libgtk2.0-dev libmbedtls-dev ninja-build libstring-shellquote-perl libipc-system-simple-perl
399393
curl -sSL https://github.com/ocaml/opam/releases/download/2.3.0/opam-2.3.0-x86_64-linux -o $RUNNER_TEMP/opam
400394
sudo install $RUNNER_TEMP/opam /usr/local/bin/opam
401395

.github/workflows/release.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ jobs:
151151
- name: Check artifact
152152
shell: bash
153153
run: |
154-
mkdir ./plugins/ecso/cmxs/hx-4.3.7
155-
mv -T ./plugins/ecso/cmxs/Windows ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}
156-
cygcheck ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}/plugin.cmxs
157154
ls out
158155
# Output should contain binaries zip, installer zip and nupkg
159156
[ $(ls -1 out | wc -l) -eq "3" ]
@@ -298,9 +295,6 @@ jobs:
298295
- name: Check artifact
299296
shell: bash
300297
run: |
301-
mkdir ./plugins/ecso/cmxs/hx-4.3.7
302-
mv -T ./plugins/ecso/cmxs/Windows ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}
303-
cygcheck ./plugins/ecso/cmxs/hx-4.3.7/Windows${ARCH}/plugin.cmxs
304298
ls out
305299
# Output should contain binaries zip, installer zip and nupkg
306300
[ $(ls -1 out | wc -l) -eq "3" ]
@@ -366,7 +360,7 @@ jobs:
366360
run: |
367361
set -ex
368362
sudo apt-get update -qqy
369-
sudo apt-get install -qqy darcs bubblewrap ocaml-nox libpcre2-dev zlib1g-dev libgtk2.0-dev libmbedtls-dev ninja-build libstring-shellquote-perl libipc-system-simple-perl
363+
sudo apt-get install -qqy bubblewrap ocaml-nox libpcre2-dev zlib1g-dev libgtk2.0-dev libmbedtls-dev ninja-build libstring-shellquote-perl libipc-system-simple-perl
370364
curl -sSL https://github.com/ocaml/opam/releases/download/2.3.0/opam-2.3.0-x86_64-linux -o $RUNNER_TEMP/opam
371365
sudo install $RUNNER_TEMP/opam /usr/local/bin/opam
372366

extra/github-actions/Main.hx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ class Main {
9090
var originalWorkflow = Http.requestUrl(workflow.url);
9191
final jobTab:String = {
9292
final r = ~/([ \t]*)jobs\s*:[\r\n]*([ \t]*)/;
93-
r.match(originalWorkflow);
93+
if(!r.match(originalWorkflow))
94+
throw false;
9495
r.matched(1) + r.matched(2);
9596
}
9697
// Fix job name collisions
@@ -104,7 +105,8 @@ class Main {
104105
}
105106
for (jobName in workflow.jobs) {
106107
final r = new EReg('\\n$jobTab$jobName\\s*:\\s*(#.*\\n|\\n)((\\s*\\n|$jobTab$jobTab.*\\n)+)', 'm');
107-
r.match(originalWorkflow);
108+
if(!r.match(originalWorkflow))
109+
throw false;
108110
final job:Job = {
109111
id: uniqueName(jobName),
110112
name: 'Haxe ${workflow.haxeVersion} / $jobName',
@@ -147,7 +149,7 @@ class Main {
147149

148150
static function transform(script:String, build:BuildManifest, manifest:JobManifest) {
149151
// Lock Runner OS
150-
script = matchRunnerOS.map(script, function(reg:EReg) {
152+
script = map(matchRunnerOS, script, function(reg:EReg) {
151153
var matched = reg.matched(0);
152154
var tabs = reg.matched(1);
153155
var os = reg.matched(2).toLowerCase();
@@ -156,7 +158,7 @@ class Main {
156158
});
157159

158160
// Replace Haxe checkout with `checkout-haxe.yml` and `checkout-ecso.yml`
159-
script = matchHaxeCheckout.map(script, function(reg:EReg) {
161+
script = map(matchHaxeCheckout, script, function(reg:EReg) {
160162
var matched = reg.matched(0);
161163
var head = reg.matched(1);
162164
var action = reg.matched(2);
@@ -178,6 +180,7 @@ class Main {
178180
});
179181

180182
// Lock Ocaml setup
183+
181184
script = matchOpamInstallHaxe.map(script, function(reg:EReg) {
182185
var matched = reg.matched(0);
183186
var install = reg.matched(1);
@@ -193,7 +196,8 @@ class Main {
193196

194197
// Lock Neko version
195198
if (manifest.nekoDownload != null) {
196-
script = ~/(https?:\/\/\S+\/(neko_latest\.(zip|tar\.gz))\/?)\s/gm.map(script, function(reg:EReg) {
199+
var matchNekoVersion = ~/(https?:\/\/\S+\/(neko_latest\.(zip|tar\.gz))\/?)\s/gm;
200+
script = map(matchNekoVersion, script, function(reg:EReg) {
197201
final matched = reg.matched(0);
198202
final url = reg.matched(1);
199203
final file = reg.matched(2);
@@ -204,7 +208,7 @@ class Main {
204208
}
205209

206210
// Add commands before `make haxe`
207-
script = matchMakeHaxe.map(script, function(reg:EReg) {
211+
script = map(matchMakeHaxe, script, function(reg:EReg) {
208212
var matched = reg.matched(0);
209213
var cmd = reg.matched(1);
210214
var haxe = reg.matched(3);
@@ -227,11 +231,11 @@ class Main {
227231
// Rename build jobs
228232
script = script.replace("Build Haxe", "Build Haxe + Ecso");
229233
// Build ecso as plugin (after haxelib)
230-
script = matchMakeHaxelib.map(script, function(reg:EReg) {
234+
script = map(matchMakeHaxelib, script, function(reg:EReg) {
231235
found = true;
232236
var pos = reg.matchedPos();
233237
var makeEcso = "";
234-
matchMakeHaxe.map(script.substring(0, pos.pos), function(reg:EReg) {
238+
map(matchMakeHaxe, script.substring(0, pos.pos), function(reg:EReg) {
235239
var matched = reg.matched(0);
236240
var cmd = reg.matched(1);
237241
var make = reg.matched(2);
@@ -250,31 +254,31 @@ class Main {
250254
// Rename build jobs
251255
script = script.replace("Build Haxe", "Build Ecso");
252256
// Build ecso instead of haxe/haxelib
253-
script = matchMakeHaxe.map(script, function(reg:EReg) {
257+
script = map(matchMakeHaxe, script, function(reg:EReg) {
254258
found = true;
255259
var matched = reg.matched(0);
256260
var cmd = reg.matched(1);
257261
var haxe = reg.matched(3);
258262
return matched.replace(haxe, "PLUGIN=ecso plugin");
259263
});
260-
script = matchMakeHaxelib.map(script, function(reg:EReg) {
264+
script = map(matchMakeHaxelib, script, function(reg:EReg) {
261265
var matched = reg.matched(0);
262266
var cmd = reg.matched(1);
263267
return "";
264268
});
265-
script = matchMakePackage.map(script, function(reg:EReg) {
269+
script = map(matchMakePackage, script, function(reg:EReg) {
266270
final matched = reg.matched(0);
267271
final cmd = reg.matched(1);
268272
return matched.replace(cmd, "mkdir ./out");
269273
});
270-
script = matchBuildCheck.map(script, function(reg:EReg) {
274+
script = map(matchBuildCheck, script, function(reg:EReg) {
271275
return "";
272276
});
273277
found;
274278
}
275279

276280
// Move binaries
277-
script = matchCheckOut.map(script, function(reg:EReg) {
281+
script = map(matchCheckOut, script, function(reg:EReg) {
278282
var matched = reg.matched(0);
279283
var cmd = reg.matched(1);
280284
final platform = switch manifest.os.name {
@@ -300,7 +304,7 @@ class Main {
300304
});
301305

302306
// Upload artifact
303-
script = matchUploadArtifact.map(script, function(reg:EReg) {
307+
script = map(matchUploadArtifact, script, function(reg:EReg) {
304308
var matched = reg.matched(0);
305309
if (matched.contains("xmldoc"))
306310
return matched;
@@ -351,7 +355,7 @@ class Main {
351355
script = script.replace("startsWith(github.ref, 'refs/tags/')", manifest.development != null ? '${!manifest.development}' : 'true');
352356

353357
// Allow job failure
354-
script = matchRunnerOS.map(script, function(reg:EReg) {
358+
script = map(matchRunnerOS, script, function(reg:EReg) {
355359
var matched = reg.matched(0);
356360
var tabs = reg.matched(1);
357361

@@ -422,4 +426,10 @@ class Main {
422426
final spaces = head.substr(head.lastIndexOf("\n") + 1);
423427
return head + value.replace('\n', '\n$spaces');
424428
}
425-
}
429+
430+
static inline function map(ereg:EReg, with:String, f):String {
431+
if(!ereg.match(with))
432+
throw 'No match with ${Std.string(ereg)} for $with';
433+
return ereg.map(with, f);
434+
}
435+
}

extra/github-actions/build.hxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# --run Main
22
--main Main
3+
--debug
34
--neko Main.n
45
--cmd neko Main.n

0 commit comments

Comments
 (0)