@@ -27,14 +27,19 @@ jobs:
27
27
include :
28
28
- os : macos-13 # x64
29
29
rust-target : x86_64-apple-darwin
30
+ node-target : darwin-x64
30
31
- os : macos-14 # ARM
31
32
rust-target : aarch64-apple-darwin
33
+ node-target : darwin-arm64
32
34
- os : ubuntu-24.04 # x64
33
35
rust-target : x86_64-unknown-linux-musl
36
+ node-target : linux-x64
34
37
- os : ubuntu-24.04-arm # ARM
35
38
rust-target : aarch64-unknown-linux-musl
39
+ node-target : linux-arm64
36
40
- os : windows-latest
37
41
rust-target : x86_64-pc-windows-gnu
42
+ node-target : win32-x64
38
43
39
44
runs-on : ${{matrix.os}}
40
45
@@ -66,25 +71,24 @@ jobs:
66
71
uses : dtolnay/rust-toolchain@master
67
72
with :
68
73
toolchain : stable
69
- targets : ${{matrix.rust-target}}
74
+ targets : ${{ matrix.rust-target }}
70
75
71
76
- name : Build rewatch
72
77
if : steps.build-cache.outputs.cache-hit != 'true'
73
- run : cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release
74
-
75
- - name : Copy rewatch exe to platform bin dir
76
78
run : |
77
- cp rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch
78
- node ./scripts/copyExes.js -rewatch
79
+ cargo build --manifest-path rewatch/Cargo.toml --target ${{ matrix.rust-target }} --release
79
80
80
- - name : Get artifact dir name
81
- run : node .github/workflows/get_artifact_dir_name.js
81
+ - name : Copy rewatch binary
82
+ run : |
83
+ cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch.exe
84
+ shell : bash
82
85
83
86
- name : " Upload artifact: rewatch binary"
84
87
uses : actions/upload-artifact@v4
85
88
with :
86
- name : rewatch-${{env.artifact_dir_name}}
87
- path : ${{ env.artifact_dir_name }}
89
+ name : rewatch-${{ matrix.node-target }}
90
+ path : rewatch.exe
91
+ if-no-files-found : error
88
92
89
93
build-compiler :
90
94
strategy :
@@ -95,21 +99,26 @@ jobs:
95
99
ocaml_compiler : ocaml-variants.5.3.0+options,ocaml-option-static
96
100
upload_binaries : true
97
101
upload_libs : true
102
+ node-target : linux-x64
98
103
- os : ubuntu-24.04-arm # ARM
99
104
ocaml_compiler : ocaml-variants.5.3.0+options,ocaml-option-static
100
105
upload_binaries : true
101
106
# Build the playground compiler and run the benchmarks on the fastest runner
102
107
build_playground : true
103
108
benchmarks : true
109
+ node-target : linux-arm64
104
110
- os : macos-13 # x64
105
111
ocaml_compiler : 5.3.0
106
112
upload_binaries : true
113
+ node-target : darwin-x64
107
114
- os : macos-14 # ARM
108
115
ocaml_compiler : 5.3.0
109
116
upload_binaries : true
117
+ node-target : darwin-arm64
110
118
- os : windows-latest
111
119
ocaml_compiler : 5.3.0
112
120
upload_binaries : true
121
+ node-target : win32-x64
113
122
114
123
# Verify that the compiler still builds with older OCaml versions
115
124
- os : ubuntu-24.04
@@ -144,9 +153,6 @@ jobs:
144
153
cache : yarn
145
154
node-version-file : .nvmrc
146
155
147
- - name : Get artifact dir name
148
- run : node .github/workflows/get_artifact_dir_name.js
149
-
150
156
- name : Install dependencies (Linux)
151
157
if : runner.os == 'Linux'
152
158
@@ -303,13 +309,13 @@ jobs:
303
309
run : yarn install
304
310
305
311
- name : Copy compiler exes to platform bin dir
306
- run : node ./ scripts/copyExes.js -compiler
312
+ run : node scripts/copyExes.js - -compiler
307
313
308
314
- name : Restore ninja build cache
309
315
id : ninja-build-cache
310
316
uses : actions/cache@v4
311
317
with :
312
- path : ${{ env.artifact_dir_name }}/ninja.exe
318
+ path : packages/@rescript/ ${{ matrix.node-target }}/bin /ninja.exe
313
319
key : ninja-build-v1-${{ matrix.os }}-${{ hashFiles('ninja/src/**') }}
314
320
315
321
- name : Setup Python for ninja build
@@ -336,7 +342,7 @@ jobs:
336
342
337
343
- name : Copy ninja exe to platform bin dir
338
344
if : steps.ninja-build-cache.outputs.cache-hit != 'true'
339
- run : node ./ scripts/copyExes.js -ninja
345
+ run : node scripts/copyExes.js - -ninja
340
346
341
347
- name : " Syntax: Run roundtrip tests"
342
348
if : ${{ runner.os != 'Windows' }}
@@ -423,8 +429,8 @@ jobs:
423
429
if : matrix.upload_binaries
424
430
uses : actions/upload-artifact@v4
425
431
with :
426
- name : binaries-${{ env.artifact_dir_name }}
427
- path : ${{ env.artifact_dir_name }}
432
+ name : binaries-${{ matrix.node-target }}
433
+ path : packages/@rescript/ ${{ matrix.node-target }}/bin
428
434
429
435
- name : " Upload artifacts: lib/ocaml"
430
436
if : matrix.upload_libs
@@ -433,13 +439,11 @@ jobs:
433
439
name : lib-ocaml
434
440
path : lib/ocaml
435
441
436
- package :
437
- needs :
438
- - build-compiler
442
+ pkg-pr-new :
443
+ needs :
439
444
- build-rewatch
440
-
441
- runs-on : ubuntu-24.04
442
-
445
+ - build-compiler
446
+ runs-on : ubuntu-24.04-arm
443
447
steps :
444
448
- name : Checkout
445
449
uses : actions/checkout@v4
@@ -450,59 +454,40 @@ jobs:
450
454
cache : yarn
451
455
node-version-file : .nvmrc
452
456
453
- - name : NPM install
454
- run : yarn install
455
-
456
457
- name : Download artifacts
457
458
uses : actions/download-artifact@v4
458
459
with :
459
460
pattern : " @(binaries-*|rewatch-*|lib-ocaml)"
460
461
461
- - name : Move artifacts
462
- run : ./scripts/moveArtifacts.sh
463
-
464
- - name : npm pack (rescript) + check artifact list
465
- run : node ./scripts/npmPack.js
466
-
467
- - name : Copy JS files to stdlib package
468
- run : mkdir -p packages/std/lib && cp -R lib/es6 lib/js packages/std/lib
469
-
470
- - name : npm pack (@rescript/std)
471
- run : npm pack
472
- working-directory : packages/std
473
-
474
- - name : Prepare package upload
475
- # For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
476
- run : node .github/workflows/prepare_package_upload.js ${{ github.event.pull_request.head.sha }}
477
-
478
- - name : " Upload artifact: npm packages"
479
- uses : actions/upload-artifact@v4
480
- with :
481
- name : npm-packages
482
- path : |
483
- rescript-${{ env.rescript_version }}.tgz
484
- rescript-std-${{ env.rescript_version }}.tgz
462
+ - name : Move artifacts into packages
463
+ run : .github/workflows/moveArtifacts.sh
464
+ shell : bash
485
465
486
- outputs :
487
- rescript_version : ${{ env.rescript_version }}
466
+ - name : Publish packages to pkg.pr.new
467
+ run : |
468
+ yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"
488
469
489
470
installationTest :
490
- needs : package
471
+ needs :
472
+ - pkg-pr-new
491
473
strategy :
492
474
fail-fast : false
493
475
matrix :
494
- os : [
495
- macos-13, # x64
496
- macos-14, # ARM
497
- ubuntu-24.04,
498
- ubuntu-24.04-arm,
499
- windows-latest,
500
- ]
501
-
502
- runs-on : ${{matrix.os}}
503
-
476
+ include :
477
+ - os : macos-13
478
+ node-target : darwin-x64
479
+ - os : macos-14
480
+ node-target : darwin-arm64
481
+ - os : ubuntu-24.04
482
+ node-target : linux-x64
483
+ - os : ubuntu-24.04-arm
484
+ node-target : linux-arm64
485
+ - os : windows-latest
486
+ node-target : win32-x64
487
+ runs-on : ${{ matrix.os }}
504
488
steps :
505
489
- name : Checkout
490
+ id : checkout
506
491
uses : actions/checkout@v4
507
492
508
493
- name : Use Node.js
@@ -523,16 +508,11 @@ jobs:
523
508
echo "path=$dir" >> "$GITHUB_OUTPUT"
524
509
cp -r tests/package_tests/installation_test/* "$dir"
525
510
526
- - name : Download artifacts
527
- uses : actions/download-artifact@v4
528
- with :
529
- name : npm-packages
530
- path : ${{ steps.tmp-dir.outputs.path }}
531
-
532
511
- name : Install ReScript package
533
512
run : |
534
- npm i --ignore-scripts --no-audit \
535
- rescript-${{ needs.package.outputs.rescript_version }}.tgz
513
+ COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
514
+ npm i --no-audit \
515
+ "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
536
516
shell : bash
537
517
working-directory : ${{ steps.tmp-dir.outputs.path }}
538
518
@@ -542,12 +522,12 @@ jobs:
542
522
working-directory : ${{ steps.tmp-dir.outputs.path }}
543
523
544
524
publish :
545
- needs : [package, installationTest]
546
-
525
+ needs :
526
+ - build-rewatch
527
+ - build-compiler
528
+ - installationTest
547
529
if : startsWith(github.ref, 'refs/tags/v')
548
-
549
- runs-on : ubuntu-24.04
550
-
530
+ runs-on : ubuntu-24.04-arm
551
531
steps :
552
532
- name : Checkout
553
533
uses : actions/checkout@v4
@@ -562,14 +542,18 @@ jobs:
562
542
- name : Download artifacts
563
543
uses : actions/download-artifact@v4
564
544
with :
565
- name : npm-packages
545
+ pattern : " @(binaries-*|rewatch-*|lib-ocaml)"
546
+
547
+ - name : Move artifacts into packages
548
+ run : .github/workflows/moveArtifacts.sh
549
+ shell : bash
566
550
567
551
- name : Publish packages on npm with tag "ci"
568
552
env :
569
- NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
553
+ YARN_NPM_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
570
554
run : |
571
- npm publish rescript-${{ needs.package.outputs.rescript_version }}.tgz --tag ci
572
- npm publish rescript-std-${{ needs.package.outputs.rescript_version }}.tgz --tag ci
555
+ yarn workspaces foreach -W --no-private \
556
+ npm publish --tag ci
573
557
574
558
- name : Update Website Playground
575
559
env :
0 commit comments