Skip to content

Commit 3b10332

Browse files
authored
CI: do not wait for rewatch before starting compiler build (#6919)
1 parent 6cfcf3c commit 3b10332

File tree

4 files changed

+34
-58
lines changed

4 files changed

+34
-58
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,19 @@ jobs:
7575
if: steps.build-cache.outputs.cache-hit != 'true'
7676
run: cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release
7777

78+
- name: Copy exe to platform bin dirs
79+
run: |
80+
cp rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch
81+
node ./scripts/copyExes.js -rewatch
82+
7883
- name: Get artifact dir name
7984
run: node .github/workflows/get_artifact_dir_name.js
8085

8186
- name: "Upload artifact: rewatch binary"
8287
uses: actions/upload-artifact@v4
8388
with:
8489
name: rewatch-${{env.artifact_dir_name}}
85-
path: rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }}
90+
path: ${{ env.artifact_dir_name }}
8691

8792
# Build statically linked Linux binaries in an Alpine-based Docker container
8893
# See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
@@ -108,32 +113,6 @@ jobs:
108113
with:
109114
args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap"
110115

111-
- name: "Upload artifacts"
112-
uses: actions/upload-artifact@v4
113-
with:
114-
name: static-binaries-linux-${{runner.arch}}
115-
path: |
116-
_build/install/default/bin
117-
ninja/ninja
118-
119-
# The full build including tests does not work on Linux ARM because setup-ocaml fails.
120-
# Therefore, only upload the binaries from the static build
121-
upload-linux-arm64-binaries:
122-
needs:
123-
- build-rewatch
124-
- static-binaries-linux-arm
125-
126-
runs-on: buildjet-2vcpu-ubuntu-2204-arm
127-
128-
steps:
129-
- name: Checkout
130-
uses: actions/checkout@v4
131-
132-
- name: Download static linux binaries
133-
uses: actions/download-artifact@v4
134-
with:
135-
name: static-binaries-linux-${{ runner.arch }}
136-
137116
- name: Use Node.js
138117
uses: actions/setup-node@v4
139118
with:
@@ -142,14 +121,8 @@ jobs:
142121
- name: Get artifact dir name
143122
run: node .github/workflows/get_artifact_dir_name.js
144123

145-
- name: Download rewatch binary
146-
uses: actions/download-artifact@v4
147-
with:
148-
name: rewatch-${{ env.artifact_dir_name }}
149-
path: rewatch
150-
151124
- name: Copy exes to platform bin dirs
152-
run: node ./scripts/copyExes.js
125+
run: node ./scripts/copyExes.js -compiler
153126

154127
- name: "Upload artifacts: binaries"
155128
uses: actions/upload-artifact@v4
@@ -158,9 +131,6 @@ jobs:
158131
path: ${{ env.artifact_dir_name }}
159132

160133
build:
161-
needs:
162-
- build-rewatch
163-
164134
strategy:
165135
fail-fast: false
166136
matrix:
@@ -197,12 +167,6 @@ jobs:
197167
- name: Get artifact dir name
198168
run: node .github/workflows/get_artifact_dir_name.js
199169

200-
- name: Download rewatch binary
201-
uses: actions/download-artifact@v4
202-
with:
203-
name: rewatch-${{ env.artifact_dir_name }}
204-
path: rewatch
205-
206170
- name: Install dependencies (Linux)
207171
if: runner.os == 'Linux'
208172
uses: awalsh128/[email protected]
@@ -345,7 +309,7 @@ jobs:
345309
run: node scripts/buildNinjaBinary.js
346310

347311
- name: Copy exes to platform bin dirs
348-
run: node ./scripts/copyExes.js
312+
run: node ./scripts/copyExes.js -compiler
349313

350314
- name: "Check if syntax subfolder has changed"
351315
id: syntax-diff
@@ -424,7 +388,11 @@ jobs:
424388
path: lib/ocaml
425389

426390
package:
427-
needs: build
391+
needs:
392+
- build
393+
- build-rewatch
394+
- static-binaries-linux-arm
395+
428396
runs-on: ubuntu-latest
429397

430398
steps:
@@ -442,7 +410,7 @@ jobs:
442410
- name: Download artifacts
443411
uses: actions/download-artifact@v4
444412
with:
445-
pattern: "@(binaries-*|lib-ocaml)"
413+
pattern: "@(binaries-*|rewatch-*|lib-ocaml)"
446414

447415
- name: Move artifacts
448416
run: ./scripts/moveArtifacts.sh

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DUNE_BIN_DIR = ./_build/install/default/bin
44

55
build: ninja rewatch
66
dune build
7-
./scripts/copyExes.js
7+
./scripts/copyExes.js -compiler
88

99
watch:
1010
dune build -w
@@ -18,6 +18,7 @@ dce:
1818
rewatch:
1919
cargo build --manifest-path rewatch/Cargo.toml
2020
cp rewatch/target/debug/rewatch rewatch
21+
./scripts/copyExes.js -rewatch
2122

2223
ninja/ninja:
2324
./scripts/buildNinjaBinary.js

scripts/copyExes.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ function copyExe(dir, exe) {
3131
}
3232
}
3333

34-
copyExe(duneBinDir, "rescript");
35-
copyExe(duneBinDir, "bsc");
36-
copyExe(duneBinDir, "bsb_helper");
37-
copyExe(ninjaDir, "ninja");
38-
copyExe(rewatchDir, "rewatch");
34+
if (process.argv.includes("-all") || process.argv.includes("-compiler")) {
35+
copyExe(duneBinDir, "rescript");
36+
copyExe(duneBinDir, "bsc");
37+
copyExe(duneBinDir, "bsb_helper");
38+
copyExe(ninjaDir, "ninja");
39+
}
40+
41+
if (process.argv.includes("-all") || process.argv.includes("-rewatch")) {
42+
copyExe(rewatchDir, "rewatch");
43+
}

scripts/moveArtifacts.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ check_statically_linked() {
2424
fi
2525
}
2626

27-
chmod +x binaries-*/*.exe
27+
chmod +x binaries-*/*.exe rewatch-*/*.exe
2828

29-
mv binaries-darwin darwin
30-
mv binaries-darwinarm64 darwinarm64
31-
mv binaries-linux linux
32-
mv binaries-linuxarm64 linuxarm64
33-
mv binaries-win32 win32
29+
mkdir darwin darwinarm64 linux linuxarm64 win32
30+
31+
mv binaries-darwin/* rewatch-darwin/* darwin
32+
mv binaries-darwinarm64/* rewatch-darwinarm64/* darwinarm64
33+
mv binaries-linux/* rewatch-linux/* linux
34+
mv binaries-linuxarm64/* rewatch-linuxarm64/* linuxarm64
35+
mv binaries-win32/* rewatch-win32/* win32
3436

3537
mv lib-ocaml lib/ocaml
3638
mv ninja/COPYING ninja.COPYING

0 commit comments

Comments
 (0)