45
45
- name : Checkout
46
46
uses : actions/checkout@v4
47
47
48
+ - name : Use Node.js
49
+ uses : actions/setup-node@v4
50
+ with :
51
+ node-version-file : .nvmrc
52
+
48
53
- name : Restore build cache
49
54
id : build-cache
50
55
uses : actions/cache@v4
@@ -109,8 +114,6 @@ jobs:
109
114
# Verify that the compiler still builds with older OCaml versions
110
115
- os : ubuntu-24.04
111
116
ocaml_compiler : ocaml-variants.5.2.1+options,ocaml-option-static
112
- # Reanalyze does not work on OCaml 5.3.0 anymore, therefore run it on 5.2.1
113
- run_reanalyze : true
114
117
- os : ubuntu-24.04
115
118
ocaml_compiler : ocaml-variants.5.0.0+options,ocaml-option-static
116
119
- os : ubuntu-24.04
@@ -137,6 +140,7 @@ jobs:
137
140
- name : Use Node.js
138
141
uses : actions/setup-node@v4
139
142
with :
143
+ cache : yarn
140
144
node-version-file : .nvmrc
141
145
142
146
- name : Get artifact dir name
@@ -153,7 +157,7 @@ jobs:
153
157
# matrix.ocaml_compiler may contain commas
154
158
- name : Get OPAM cache key
155
159
shell : bash
156
- run : echo "opam_cache_key=opam-env-v7-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project ') }}" | sed 's/,/-/g' >> $GITHUB_ENV
160
+ run : echo "opam_cache_key=opam-env-v7-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam ') }}" | sed 's/,/-/g' >> $GITHUB_ENV
157
161
158
162
- name : Restore OPAM environment
159
163
id : cache-opam-env
@@ -191,10 +195,6 @@ jobs:
191
195
if : steps.cache-opam-env.outputs.cache-hit != 'true'
192
196
run : opam install . --deps-only --with-test
193
197
194
- - name : " Install reanalyze"
195
- if : steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.run_reanalyze
196
- run : opam install reanalyze
197
-
198
198
- name : Cache OPAM environment
199
199
if : steps.cache-opam-env.outputs.cache-hit != 'true'
200
200
uses : actions/cache/save@v4
@@ -250,6 +250,24 @@ jobs:
250
250
fi
251
251
shell : bash
252
252
253
+ - name : Compiler build state key
254
+ id : compiler-build-state-key
255
+ shell : bash
256
+ run : |
257
+ echo "value=compiler-build-state-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam') }}" \
258
+ | sed 's/,/-/g' >> "$GITHUB_OUTPUT"
259
+
260
+ - name : Restore compiler build state
261
+ if : github.base_ref == 'master' || github.ref == 'refs/heads/master'
262
+ id : compiler-build-state
263
+ uses : actions/cache/restore@v4
264
+ with :
265
+ path : |
266
+ D:\.cache\dune
267
+ ~/.cache/dune
268
+ _build
269
+ key : ${{ steps.compiler-build-state-key.outputs.value }}
270
+
253
271
- name : Build compiler
254
272
if : runner.os != 'Linux'
255
273
run : opam exec -- dune build --display quiet --profile release
@@ -258,8 +276,30 @@ jobs:
258
276
if : runner.os == 'Linux'
259
277
run : opam exec -- dune build --display quiet --profile static
260
278
279
+ - name : Delete stable compiler build state
280
+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
281
+ shell : bash
282
+ run : |
283
+ gh extension install actions/gh-actions-cache
284
+ gh actions-cache delete ${{ steps.compiler-build-state-key.outputs.value }} \
285
+ -R ${{ github.repository }} \
286
+ -B ${{ github.ref }} \
287
+ --confirm || echo "not exist"
288
+ env :
289
+ GH_TOKEN : ${{ github.token }}
290
+
291
+ - name : Save compiler build state
292
+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
293
+ uses : actions/cache/save@v4
294
+ with :
295
+ path : |
296
+ D:\.cache\dune
297
+ ~/.cache/dune
298
+ _build
299
+ key : ${{ steps.compiler-build-state-key.outputs.value }}
300
+
261
301
- name : Install npm packages
262
- run : npm ci --ignore-scripts
302
+ run : yarn install
263
303
264
304
- name : Copy compiler exes to platform bin dir
265
305
run : node ./scripts/copyExes.js -compiler
@@ -305,10 +345,6 @@ jobs:
305
345
if : ${{ runner.os == 'Windows' }}
306
346
run : opam exec -- make test-syntax
307
347
308
- - name : " Syntax: Run reanalyze"
309
- if : matrix.run_reanalyze
310
- run : opam exec -- make reanalyze
311
-
312
348
- name : Build runtime/stdlib
313
349
run : ./scripts/buildRuntime.sh
314
350
shell : bash
@@ -370,11 +406,11 @@ jobs:
370
406
run : |
371
407
opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js
372
408
opam exec -- dune build --profile browser
373
- cp ./_build/default/compiler/jsoo/jsoo_playground_main.bc.js playground/compiler.js
409
+ cp ./_build/default/compiler/jsoo/jsoo_playground_main.bc.js playground/compiler.cjs
374
410
375
411
- name : Test playground compiler
376
412
if : matrix.build_playground
377
- run : node playground/playground_test.js
413
+ run : node playground/playground_test.cjs
378
414
379
415
- name : Upload playground compiler to CDN
380
416
if : ${{ matrix.build_playground && startsWith(github.ref, 'refs/tags/v') }}
@@ -411,10 +447,11 @@ jobs:
411
447
- name : Use Node.js
412
448
uses : actions/setup-node@v4
413
449
with :
450
+ cache : yarn
414
451
node-version-file : .nvmrc
415
452
416
453
- name : NPM install
417
- run : npm ci --ignore-scripts
454
+ run : yarn install
418
455
419
456
- name : Download artifacts
420
457
uses : actions/download-artifact@v4
@@ -505,6 +542,7 @@ jobs:
505
542
- name : Use Node.js
506
543
uses : actions/setup-node@v4
507
544
with :
545
+ cache : yarn
508
546
node-version-file : .nvmrc
509
547
registry-url : https://registry.npmjs.org # Needed to make auth work for publishing
510
548
0 commit comments