2020  OCAMLRUNPARAM : b 
2121
2222jobs :
23-   build-rewatch :
24-     strategy :
25-       fail-fast : false 
26-       matrix :
27-         include :
28-           - os : macos-13  #  x64
29-             rust-target : x86_64-apple-darwin 
30-             node-target : darwin-x64 
31-           - os : macos-14  #  ARM
32-             rust-target : aarch64-apple-darwin 
33-             node-target : darwin-arm64 
34-           - os : ubuntu-24.04  #  x64
35-             rust-target : x86_64-unknown-linux-musl 
36-             node-target : linux-x64 
37-           - os : ubuntu-24.04-arm  #  ARM
38-             rust-target : aarch64-unknown-linux-musl 
39-             node-target : linux-arm64 
40-           - os : windows-latest 
41-             rust-target : x86_64-pc-windows-gnu 
42-             node-target : win32-x64 
43- 
44-     runs-on : ${{matrix.os}} 
45- 
46-     env :
47-       RUST_BACKTRACE : " 1" 
48- 
49-     steps :
50-       - name : Checkout 
51-         uses : actions/checkout@v4 
52- 
53-       - name : Use Node.js 
54-         uses : actions/setup-node@v4 
55-         with :
56-           node-version-file : .nvmrc 
57- 
58-       - name : Restore build cache 
59-         id : build-cache 
60-         uses : actions/cache@v4 
61-         with :
62-           path : rewatch/target 
63-           key : rewatch-build-v2-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }} 
64- 
65-       - name : Install musl gcc 
66-         if : steps.build-cache.outputs.cache-hit != 'true' && runner.os == 'Linux' 
67-         run : sudo apt-get install -y --no-install-recommends musl-tools 
68- 
69-       - name : Install rust toolchain 
70-         if : steps.build-cache.outputs.cache-hit != 'true' 
71-         uses : dtolnay/rust-toolchain@master 
72-         with :
73-           toolchain : stable 
74-           targets : ${{ matrix.rust-target }} 
75- 
76-       - name : Build rewatch 
77-         if : steps.build-cache.outputs.cache-hit != 'true' 
78-         run : | 
79-           cargo build --manifest-path rewatch/Cargo.toml --target ${{ matrix.rust-target }} --release 
80- 
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 
85- 
86-       - name : " Upload artifact: rewatch binary" 
87-         uses : actions/upload-artifact@v4 
88-         with :
89-           name : rewatch-${{ matrix.node-target }} 
90-           path : rewatch.exe 
91-           if-no-files-found : error 
92- 
9323  build-compiler :
9424    strategy :
9525      fail-fast : false 
@@ -100,33 +30,44 @@ jobs:
10030            upload_binaries : true 
10131            upload_libs : true 
10232            node-target : linux-x64 
33+             rust-target : x86_64-unknown-linux-musl 
10334          - os : ubuntu-24.04-arm  #  ARM
10435            ocaml_compiler : ocaml-variants.5.3.0+options,ocaml-option-static 
10536            upload_binaries : true 
10637            #  Build the playground compiler and run the benchmarks on the fastest runner
10738            build_playground : true 
10839            benchmarks : true 
10940            node-target : linux-arm64 
41+             rust-target : aarch64-unknown-linux-musl 
11042          - os : macos-13  #  x64
11143            ocaml_compiler : 5.3.0 
11244            upload_binaries : true 
11345            node-target : darwin-x64 
46+             rust-target : x86_64-apple-darwin 
11447          - os : macos-14  #  ARM
11548            ocaml_compiler : 5.3.0 
11649            upload_binaries : true 
11750            node-target : darwin-arm64 
51+             rust-target : aarch64-apple-darwin 
11852          - os : windows-latest 
11953            ocaml_compiler : 5.3.0 
12054            upload_binaries : true 
12155            node-target : win32-x64 
56+             rust-target : x86_64-pc-windows-gnu 
12257
12358          #  Verify that the compiler still builds with older OCaml versions
12459          - os : ubuntu-24.04 
12560            ocaml_compiler : ocaml-variants.5.2.1+options,ocaml-option-static 
61+             node-target : linux-x64 
62+             rust-target : x86_64-unknown-linux-musl 
12663          - os : ubuntu-24.04 
12764            ocaml_compiler : ocaml-variants.5.0.0+options,ocaml-option-static 
65+             node-target : linux-x64 
66+             rust-target : x86_64-unknown-linux-musl 
12867          - os : ubuntu-24.04 
12968            ocaml_compiler : ocaml-variants.4.14.2+options,ocaml-option-static 
69+             node-target : linux-x64 
70+             rust-target : x86_64-unknown-linux-musl 
13071
13172    runs-on : ${{matrix.os}} 
13273
13576      #  we do track its version manually
13677      OPAM_VERSION : 2.3.0 
13778      DUNE_PROFILE : release 
79+       RUST_BACKTRACE : " 1" 
13880
13981    steps :
14082      - name : " Windows: Set git config" 
15395          cache : yarn 
15496          node-version-file : .nvmrc 
15597
98+       - name : Install npm packages 
99+         run : yarn install 
100+ 
156101      - name : Install dependencies (Linux) 
157102        if : runner.os == 'Linux' 
158103@@ -161,6 +106,36 @@ jobs:
161106          packages : bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync 
162107          version : v3 
163108
109+       - name : Restore rewatch build cache 
110+         id : rewatch-build-cache 
111+         uses : actions/cache@v4 
112+         with :
113+           path : rewatch/target 
114+           key : rewatch-build-v2-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }} 
115+ 
116+       - name : Install rust toolchain 
117+         if : steps.rewatch-build-cache.outputs.cache-hit != 'true' 
118+         uses : dtolnay/rust-toolchain@master 
119+         with :
120+           toolchain : stable 
121+           targets : ${{ matrix.rust-target }} 
122+ 
123+       - name : Build rewatch 
124+         if : steps.rewatch-build-cache.outputs.cache-hit != 'true' 
125+         run : | 
126+           cargo build --manifest-path rewatch/Cargo.toml --target ${{ matrix.rust-target }} --release 
127+ 
128+        - name : Run rewatch unit tests 
129+         if : steps.rewatch-build-cache.outputs.cache-hit != 'true' 
130+         run : | 
131+           cargo test --manifest-path rewatch/Cargo.toml 
132+ 
133+        - name : Copy rewatch binary 
134+         run : | 
135+           cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch 
136+           ./scripts/copyExes.js --rewatch 
137+          shell : bash 
138+ 
164139      #  matrix.ocaml_compiler may contain commas
165140      - name : Get OPAM cache key 
166141        shell : bash 
@@ -305,9 +280,6 @@ jobs:
305280            _build 
306281           key : ${{ steps.compiler-build-state-key.outputs.value }} 
307282
308-       - name : Install npm packages 
309-         run : yarn install 
310- 
311283      - name : Copy compiler exes to platform bin dir 
312284        run : node scripts/copyExes.js --compiler 
313285
@@ -352,7 +324,13 @@ jobs:
352324        if : ${{ runner.os == 'Windows' }} 
353325        run : opam exec -- make test-syntax 
354326
355-       - name : Build runtime/stdlib 
327+       - name : Build runtime/stdlib with rewatch 
328+         if : ${{ runner.os != 'Windows' }} 
329+         run : ./scripts/buildRuntimeRewatch.sh 
330+         shell : bash 
331+ 
332+       - name : Build runtime/stdlib with bsb (Windows) 
333+         if : ${{ runner.os == 'Windows' }} 
356334        run : ./scripts/buildRuntime.sh 
357335        shell : bash 
358336
@@ -440,8 +418,7 @@ jobs:
440418          path : lib/ocaml 
441419
442420  pkg-pr-new :
443-     needs : 
444-       - build-rewatch 
421+     needs :
445422      - build-compiler 
446423    runs-on : ubuntu-24.04-arm 
447424    steps :
@@ -457,7 +434,7 @@ jobs:
457434      - name : Download artifacts 
458435        uses : actions/download-artifact@v4 
459436        with :
460-           pattern : " @(binaries-*|rewatch-*| lib-ocaml)" 
437+           pattern : " @(binaries-*|lib-ocaml)" 
461438
462439      - name : Move artifacts into packages 
463440        run : .github/workflows/moveArtifacts.sh 
@@ -467,27 +444,23 @@ jobs:
467444        run : | 
468445          yarn dlx pkg-pr-new publish "." "./packages/@rescript/*" 
469446
470-    installationTest :
447+    test-integration :
471448    needs :
472449      - pkg-pr-new 
473450    strategy :
474451      fail-fast : false 
475452      matrix :
476453        include :
477454          - os : macos-13 
478-             node-target : darwin-x64 
479455          - os : macos-14 
480-             node-target : darwin-arm64 
481456          - os : ubuntu-24.04 
482-             node-target : linux-x64 
483457          - os : ubuntu-24.04-arm 
484-             node-target : linux-arm64 
485458          - os : windows-latest 
486-             node-target : win32-x64 
487459    runs-on : ${{ matrix.os }} 
460+     env :
461+       RUST_BACKTRACE : " 1" 
488462    steps :
489463      - name : Checkout 
490-         id : checkout 
491464        uses : actions/checkout@v4 
492465
493466      - name : Use Node.js 
@@ -521,11 +494,22 @@ jobs:
521494        shell : bash 
522495        working-directory : ${{ steps.tmp-dir.outputs.path }} 
523496
497+       - name : Install ReScript package in rewatch/testrepo 
498+         if : runner.os == 'Linux' 
499+         run : | 
500+           COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}" 
501+           yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}" 
502+          shell : bash 
503+         working-directory : rewatch/testrepo 
504+ 
505+       - name : Run rewatch integration tests 
506+         #  Currently failing on Windows and intermittently on macOS
507+         if : runner.os == 'Linux' 
508+         run : make test-rewatch-ci 
509+ 
524510  publish :
525511    needs :
526-       - build-rewatch 
527-       - build-compiler 
528-       - installationTest 
512+       - test-integration 
529513    if : startsWith(github.ref, 'refs/tags/v') 
530514    runs-on : ubuntu-24.04-arm 
531515    steps :
@@ -542,7 +526,7 @@ jobs:
542526      - name : Download artifacts 
543527        uses : actions/download-artifact@v4 
544528        with :
545-           pattern : " @(binaries-*|rewatch-*| lib-ocaml)" 
529+           pattern : " @(binaries-*|lib-ocaml)" 
546530
547531      - name : Move artifacts into packages 
548532        run : .github/workflows/moveArtifacts.sh 
0 commit comments