Skip to content

Commit f1fc607

Browse files
committed
Fix CI, move rewatch build steps into main compiler build job
1 parent 64f84ea commit f1fc607

File tree

3 files changed

+58
-88
lines changed

3 files changed

+58
-88
lines changed

.github/workflows/ci.yml

+47-82
Original file line numberDiff line numberDiff line change
@@ -46,81 +46,6 @@ jobs:
4646
run: |
4747
make test-rewatch-ci
4848
49-
build-rewatch:
50-
strategy:
51-
fail-fast: false
52-
matrix:
53-
include:
54-
- os: macos-13 # x64
55-
rust-target: x86_64-apple-darwin
56-
node-target: darwin-x64
57-
- os: macos-14 # ARM
58-
rust-target: aarch64-apple-darwin
59-
node-target: darwin-arm64
60-
- os: ubuntu-24.04 # x64
61-
rust-target: x86_64-unknown-linux-musl
62-
node-target: linux-x64
63-
- os: ubuntu-24.04-arm # ARM
64-
rust-target: aarch64-unknown-linux-musl
65-
node-target: linux-arm64
66-
- os: windows-latest
67-
rust-target: x86_64-pc-windows-gnu
68-
node-target: win32-x64
69-
70-
runs-on: ${{matrix.os}}
71-
72-
env:
73-
RUST_BACKTRACE: "1"
74-
75-
steps:
76-
- name: Checkout
77-
uses: actions/checkout@v4
78-
79-
- name: Use Node.js
80-
uses: actions/setup-node@v4
81-
with:
82-
node-version-file: .nvmrc
83-
84-
- name: Restore build cache
85-
id: build-cache
86-
uses: actions/cache@v4
87-
with:
88-
path: rewatch/target
89-
key: rewatch-build-v2-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }}
90-
91-
- name: Install musl gcc
92-
if: steps.build-cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
93-
run: sudo apt-get install -y --no-install-recommends musl-tools
94-
95-
- name: Install rust toolchain
96-
if: steps.build-cache.outputs.cache-hit != 'true'
97-
uses: dtolnay/rust-toolchain@master
98-
with:
99-
toolchain: stable
100-
targets: ${{ matrix.rust-target }}
101-
102-
- name: Build rewatch
103-
if: steps.build-cache.outputs.cache-hit != 'true'
104-
run: |
105-
cargo build --manifest-path rewatch/Cargo.toml --target ${{ matrix.rust-target }} --release
106-
107-
- name: Run rewatch unit tests
108-
if: steps.build-cache.outputs.cache-hit != 'true'
109-
run: |
110-
cargo test --manifest-path rewatch/Cargo.toml
111-
112-
- name: Copy rewatch binary
113-
run: |
114-
cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch.exe
115-
shell: bash
116-
117-
- name: "Upload artifact: rewatch binary"
118-
uses: actions/upload-artifact@v4
119-
with:
120-
name: rewatch-${{ matrix.node-target }}
121-
path: rewatch.exe
122-
if-no-files-found: error
123-
12449
build-compiler:
12550
strategy:
12651
fail-fast: false
@@ -131,33 +56,44 @@ jobs:
13156
upload_binaries: true
13257
upload_libs: true
13358
node-target: linux-x64
59+
rust-target: x86_64-unknown-linux-musl
13460
- os: ubuntu-24.04-arm # ARM
13561
ocaml_compiler: ocaml-variants.5.3.0+options,ocaml-option-static
13662
upload_binaries: true
13763
# Build the playground compiler and run the benchmarks on the fastest runner
13864
build_playground: true
13965
benchmarks: true
14066
node-target: linux-arm64
67+
rust-target: aarch64-unknown-linux-musl
14168
- os: macos-13 # x64
14269
ocaml_compiler: 5.3.0
14370
upload_binaries: true
14471
node-target: darwin-x64
72+
rust-target: x86_64-apple-darwin
14573
- os: macos-14 # ARM
14674
ocaml_compiler: 5.3.0
14775
upload_binaries: true
14876
node-target: darwin-arm64
77+
rust-target: aarch64-apple-darwin
14978
- os: windows-latest
15079
ocaml_compiler: 5.3.0
15180
upload_binaries: true
15281
node-target: win32-x64
82+
rust-target: x86_64-pc-windows-gnu
15383

15484
# Verify that the compiler still builds with older OCaml versions
15585
- os: ubuntu-24.04
15686
ocaml_compiler: ocaml-variants.5.2.1+options,ocaml-option-static
87+
node-target: linux-x64
88+
rust-target: x86_64-unknown-linux-musl
15789
- os: ubuntu-24.04
15890
ocaml_compiler: ocaml-variants.5.0.0+options,ocaml-option-static
91+
node-target: linux-x64
92+
rust-target: x86_64-unknown-linux-musl
15993
- os: ubuntu-24.04
16094
ocaml_compiler: ocaml-variants.4.14.2+options,ocaml-option-static
95+
node-target: linux-x64
96+
rust-target: x86_64-unknown-linux-musl
16197

16298
runs-on: ${{matrix.os}}
16399

@@ -166,6 +102,7 @@ jobs:
166102
# we do track its version manually
167103
OPAM_VERSION: 2.3.0
168104
DUNE_PROFILE: release
105+
RUST_BACKTRACE: "1"
169106

170107
steps:
171108
- name: "Windows: Set git config"
@@ -184,6 +121,9 @@ jobs:
184121
cache: yarn
185122
node-version-file: .nvmrc
186123

124+
- name: Install npm packages
125+
run: yarn install
126+
187127
- name: Install dependencies (Linux)
188128
if: runner.os == 'Linux'
189129
uses: awalsh128/[email protected]
@@ -192,6 +132,36 @@ jobs:
192132
packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync
193133
version: v3
194134

135+
- name: Restore rewatch build cache
136+
id: rewatch-build-cache
137+
uses: actions/cache@v4
138+
with:
139+
path: rewatch/target
140+
key: rewatch-build-v2-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }}
141+
142+
- name: Install rust toolchain
143+
if: steps.rewatch-build-cache.outputs.cache-hit != 'true'
144+
uses: dtolnay/rust-toolchain@master
145+
with:
146+
toolchain: stable
147+
targets: ${{ matrix.rust-target }}
148+
149+
- name: Build rewatch
150+
if: steps.rewatch-build-cache.outputs.cache-hit != 'true'
151+
run: |
152+
cargo build --manifest-path rewatch/Cargo.toml --target ${{ matrix.rust-target }} --release
153+
154+
- name: Run rewatch unit tests
155+
if: steps.rewatch-build-cache.outputs.cache-hit != 'true'
156+
run: |
157+
cargo test --manifest-path rewatch/Cargo.toml
158+
159+
- name: Copy rewatch binary
160+
run: |
161+
cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch
162+
./scripts/copyExes.js --rewatch
163+
shell: bash
164+
195165
# matrix.ocaml_compiler may contain commas
196166
- name: Get OPAM cache key
197167
shell: bash
@@ -336,9 +306,6 @@ jobs:
336306
_build
337307
key: ${{ steps.compiler-build-state-key.outputs.value }}
338308

339-
- name: Install npm packages
340-
run: yarn install
341-
342309
- name: Copy compiler exes to platform bin dir
343310
run: node scripts/copyExes.js --compiler
344311

@@ -472,7 +439,6 @@ jobs:
472439

473440
pkg-pr-new:
474441
needs:
475-
- build-rewatch
476442
- build-compiler
477443
runs-on: ubuntu-24.04-arm
478444
steps:
@@ -488,7 +454,7 @@ jobs:
488454
- name: Download artifacts
489455
uses: actions/download-artifact@v4
490456
with:
491-
pattern: "@(binaries-*|rewatch-*|lib-ocaml)"
457+
pattern: "@(binaries-*|lib-ocaml)"
492458

493459
- name: Move artifacts into packages
494460
run: .github/workflows/moveArtifacts.sh
@@ -554,7 +520,6 @@ jobs:
554520

555521
publish:
556522
needs:
557-
- build-rewatch
558523
- build-compiler
559524
- installationTest
560525
if: startsWith(github.ref, 'refs/tags/v')
@@ -573,7 +538,7 @@ jobs:
573538
- name: Download artifacts
574539
uses: actions/download-artifact@v4
575540
with:
576-
pattern: "@(binaries-*|rewatch-*|lib-ocaml)"
541+
pattern: "@(binaries-*|lib-ocaml)"
577542

578543
- name: Move artifacts into packages
579544
run: .github/workflows/moveArtifacts.sh

.github/workflows/moveArtifacts.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ check_statically_linked() {
2929
mv lib-ocaml lib/ocaml
3030

3131
# @rescript/{target}
32-
chmod +x binaries-*/*.exe rewatch-*/*.exe
33-
mv -f binaries-darwin-x64/* rewatch-darwin-x64/* "packages/@rescript/darwin-x64/bin"
34-
mv -f binaries-darwin-arm64/* rewatch-darwin-arm64/* "packages/@rescript/darwin-arm64/bin"
35-
mv -f binaries-linux-x64/* rewatch-linux-x64/* "packages/@rescript/linux-x64/bin"
36-
mv -f binaries-linux-arm64/* rewatch-linux-arm64/* "packages/@rescript/linux-arm64/bin"
37-
mv -f binaries-win32-x64/* rewatch-win32-x64/* "packages/@rescript/win32-x64/bin"
32+
chmod +x binaries-*/*.exe
33+
mv -f binaries-darwin-x64/* "packages/@rescript/darwin-x64/bin"
34+
mv -f binaries-darwin-arm64/* "packages/@rescript/darwin-arm64/bin"
35+
mv -f binaries-linux-x64/* "packages/@rescript/linux-x64/bin"
36+
mv -f binaries-linux-arm64/* "packages/@rescript/linux-arm64/bin"
37+
mv -f binaries-win32-x64/* "packages/@rescript/win32-x64/bin"
3838
check_statically_linked "packages/@rescript/linux-x64/bin"
3939
check_statically_linked "packages/@rescript/linux-arm64/bin"
4040

scripts/buildRuntimeRewatch.sh

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ set -e
33
shopt -s extglob
44

55
(cd runtime && ../cli/rewatch.js clean)
6+
7+
rm -f lib/es6/*.js lib/js/*.js lib/ocaml/*
8+
mkdir -p lib/es6 lib/js lib/ocaml
9+
mkdir -p runtime/lib/es6 runtime/lib/js
10+
611
(cd runtime && ../cli/rewatch.js build)
712

813
cp runtime/lib/es6/!(Pervasives_mini).js lib/es6

0 commit comments

Comments
 (0)