@@ -24,21 +24,14 @@ jobs:
24
24
strategy :
25
25
fail-fast : false
26
26
matrix :
27
- os : [
28
- macos-13, # x64
29
- macos-14, # ARM
30
- ubuntu-latest, # x64
31
- buildjet-2vcpu-ubuntu-2204-arm, # ARM
32
- windows-latest,
33
- ]
34
27
include :
35
- - os : macos-13
28
+ - os : macos-13 # x64
36
29
rust-target : x86_64-apple-darwin
37
- - os : macos-14
30
+ - os : macos-14 # ARM
38
31
rust-target : aarch64-apple-darwin
39
- - os : ubuntu-latest
32
+ - os : ubuntu-latest # x64
40
33
rust-target : x86_64-unknown-linux-musl
41
- - os : buildjet-2vcpu-ubuntu-2204-arm
34
+ - os : buildjet-2vcpu-ubuntu-2204-arm # ARM
42
35
rust-target : aarch64-unknown-linux-musl
43
36
- os : windows-latest
44
37
rust-target : x86_64-pc-windows-gnu
@@ -96,13 +89,10 @@ jobs:
96
89
# for more info.
97
90
# The container already comes with all required tools pre-installed
98
91
# (see https://github.com/rescript-lang/docker-rescript-ci-build/blob/main/Dockerfile).
99
- static-binaries-linux :
100
- strategy :
101
- fail-fast : false
102
- matrix :
103
- os : [ubuntu-latest, buildjet-2vcpu-ubuntu-2204-arm]
104
-
105
- runs-on : ${{matrix.os}}
92
+ # Note: Static ARM64 binaries cannot be built directly on Ubuntu runner because of
93
+ # https://github.com/ocaml/opam-repository/issues/26216
94
+ static-binaries-linux-arm :
95
+ runs-on : buildjet-2vcpu-ubuntu-2204-arm
106
96
107
97
steps :
108
98
- name : Checkout
@@ -131,7 +121,7 @@ jobs:
131
121
upload-linux-arm64-binaries :
132
122
needs :
133
123
- build-rewatch
134
- - static-binaries-linux
124
+ - static-binaries-linux-arm
135
125
136
126
runs-on : buildjet-2vcpu-ubuntu-2204-arm
137
127
@@ -140,7 +130,7 @@ jobs:
140
130
uses : actions/checkout@v4
141
131
142
132
- name : Download static linux binaries
143
- if : runner.os == 'Linux'
133
+ if : runner.os == 'Linux' && runner.arch == 'ARM64'
144
134
uses : actions/download-artifact@v4
145
135
with :
146
136
name : static-binaries-linux-${{ runner.arch }}
@@ -171,18 +161,19 @@ jobs:
171
161
build :
172
162
needs :
173
163
- build-rewatch
174
- - static-binaries-linux
175
164
176
165
strategy :
177
166
fail-fast : false
178
167
matrix :
179
- os : [
180
- macos-13, # x64
181
- macos-14, # ARM
182
- ubuntu-latest,
183
- windows-latest,
184
- ]
185
- ocaml_compiler : [5.2.0]
168
+ include :
169
+ - os : macos-13 # x64
170
+ ocaml_compiler : 5.2.0
171
+ - os : macos-14 # ARM
172
+ ocaml_compiler : 5.2.0
173
+ - os : ubuntu-latest # x64
174
+ ocaml_compiler : ocaml-variants.5.2.0+options,ocaml-option-static
175
+ - os : windows-latest
176
+ ocaml_compiler : 5.2.0
186
177
187
178
runs-on : ${{matrix.os}}
188
179
@@ -204,12 +195,6 @@ jobs:
204
195
with :
205
196
fetch-depth : 2 # to be able to check for changes in subfolder jscomp/syntax later
206
197
207
- - name : Download static linux binaries
208
- if : runner.os == 'Linux'
209
- uses : actions/download-artifact@v4
210
- with :
211
- name : static-binaries-linux-${{ runner.arch }}
212
-
213
198
- name : Get artifact dir name
214
199
run : node .github/workflows/get_artifact_dir_name.js
215
200
@@ -219,13 +204,6 @@ jobs:
219
204
name : rewatch-${{ env.artifact_dir_name }}
220
205
path : rewatch
221
206
222
- - name : Make static linux binaries executable
223
- if : runner.os == 'Linux'
224
- run : |
225
- chmod +x ninja/ninja
226
- chmod +x rewatch/rewatch
227
- chmod +x _build/install/default/bin/*
228
-
229
207
- name : Install dependencies (Linux)
230
208
if : runner.os == 'Linux'
231
209
@@ -239,6 +217,10 @@ jobs:
239
217
with :
240
218
python-version : ' 3.10'
241
219
220
+ # matrix.ocaml_compiler may contain commas
221
+ - name : Get OPAM cache key
222
+ run : echo "opam_cache_key=opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}" | sed 's/,/-/g' >> $GITHUB_ENV
223
+
242
224
- name : Restore OPAM environment
243
225
id : cache-opam-env
244
226
uses : actions/cache/restore@v4
@@ -250,7 +232,7 @@ jobs:
250
232
.opam-path
251
233
D:\cygwin
252
234
D:\.opam
253
- key : opam-env-v1- ${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}
235
+ key : ${{ env.opam_cache_key }}
254
236
255
237
- name : Use OCaml ${{matrix.ocaml_compiler}}
256
238
@@ -286,7 +268,7 @@ jobs:
286
268
.opam-path
287
269
D:\cygwin
288
270
D:\.opam
289
- key : opam-env-v1- ${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}
271
+ key : ${{ env.opam_cache_key }}
290
272
291
273
- name : Use cached OPAM environment
292
274
if : steps.cache-opam-env.outputs.cache-hit == 'true'
@@ -334,6 +316,10 @@ jobs:
334
316
if : runner.os != 'Linux'
335
317
run : opam exec -- dune build --display quiet --profile release
336
318
319
+ - name : Build compiler (Linux static)
320
+ if : runner.os == 'Linux'
321
+ run : opam exec -- dune build --display quiet --profile static
322
+
337
323
- name : Use Node.js
338
324
uses : actions/setup-node@v4
339
325
with :
@@ -349,7 +335,7 @@ jobs:
349
335
arch : x64
350
336
351
337
- name : Build ninja
352
- if : runner.os != 'Linux'
338
+ if : runner.os != 'Linux' || runner.arch != 'ARM64'
353
339
run : node scripts/buildNinjaBinary.js
354
340
355
341
- name : Copy exes to platform bin dirs
@@ -425,7 +411,7 @@ jobs:
425
411
path : ${{ env.artifact_dir_name }}
426
412
427
413
- name : " Upload artifacts: lib/ocaml"
428
- if : runner.os == 'Linux'
414
+ if : runner.os == 'Linux' && runner.arch == 'X64'
429
415
uses : actions/upload-artifact@v4
430
416
with :
431
417
name : lib-ocaml
0 commit comments