20
20
OCAMLRUNPARAM : b
21
21
22
22
jobs :
23
+ build-rewatch :
24
+ strategy :
25
+ fail-fast : false
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
+ include :
35
+ - os : macos-13
36
+ rust-target : x86_64-apple-darwin
37
+ - os : macos-14
38
+ rust-target : aarch64-apple-darwin
39
+ - os : ubuntu-latest
40
+ rust-target : x86_64-unknown-linux-musl
41
+ - os : buildjet-2vcpu-ubuntu-2204-arm
42
+ rust-target : aarch64-unknown-linux-musl
43
+ - os : windows-latest
44
+ rust-target : x86_64-pc-windows-gnu
45
+
46
+ runs-on : ${{matrix.os}}
47
+
48
+ env :
49
+ RUST_BACKTRACE : " 1"
50
+ SCCACHE_GHA_ENABLED : " true"
51
+ RUSTC_WRAPPER : " sccache"
52
+
53
+ steps :
54
+ - name : Checkout
55
+ uses : actions/checkout@v4
56
+
57
+ - name : Install musl gcc
58
+ if : runner.os == 'Linux'
59
+ run : sudo apt-get install -y musl-tools
60
+
61
+ - name : Set up sccache
62
+ uses : mozilla-actions/sccache-action@v0.0.4
63
+ with :
64
+ version : " v0.8.0"
65
+
66
+ - name : Install rust toolchain
67
+ uses : dtolnay/rust-toolchain@master
68
+ with :
69
+ toolchain : stable
70
+ targets : ${{matrix.rust-target}}
71
+
72
+ - name : Build rewatch
73
+ run : cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release
74
+
75
+ - name : Get artifact dir name
76
+ run : node .github/workflows/get_artifact_dir_name.js
77
+
78
+ - name : " Upload artifact: rewatch binary"
79
+ uses : actions/upload-artifact@v4
80
+ with :
81
+ name : rewatch-${{env.artifact_dir_name}}
82
+ path : rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }}
83
+
23
84
# Build statically linked Linux binaries in an Alpine-based Docker container
24
85
# See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
25
86
# for more info.
59
120
# Therefore, only upload the binaries from the static build
60
121
upload-linux-arm64-binaries :
61
122
needs :
123
+ - build-rewatch
62
124
- static-binaries-linux
63
125
64
126
runs-on : buildjet-2vcpu-ubuntu-2204-arm
@@ -73,31 +135,33 @@ jobs:
73
135
with :
74
136
name : static-binaries-linux-${{ runner.arch }}
75
137
76
- - name : Make static linux binaries executable
77
- if : runner.os == 'Linux'
78
- run : |
79
- chmod +x ninja/ninja
80
- chmod +x _build/install/default/bin/*
81
-
82
138
- name : Use Node.js
83
139
uses : actions/setup-node@v4
84
140
with :
85
141
node-version : 18
86
142
143
+ - name : Get artifact dir name
144
+ run : node .github/workflows/get_artifact_dir_name.js
145
+
146
+ - name : Download rewatch binary
147
+ uses : actions/download-artifact@v4
148
+ with :
149
+ name : rewatch-${{ env.artifact_dir_name }}
150
+ path : rewatch
151
+
87
152
- name : Copy exes to platform bin dirs
88
153
run : node ./scripts/copyExes.js
89
154
90
- - name : Prepare artifact upload
91
- run : node .github/workflows/get_artifact_info.js
92
-
93
155
- name : " Upload artifacts: binaries"
94
156
uses : actions/upload-artifact@v4
95
157
with :
96
- name : ${{ env.artifact_name }}
97
- path : ${{ env.artifact_path }}
158
+ name : binaries- ${{ env.artifact_dir_name }}
159
+ path : ${{ env.artifact_dir_name }}
98
160
99
161
build :
100
- needs : static-binaries-linux
162
+ needs :
163
+ - build-rewatch
164
+ - static-binaries-linux
101
165
102
166
strategy :
103
167
fail-fast : false
@@ -133,10 +197,20 @@ jobs:
133
197
with :
134
198
name : static-binaries-linux-${{ runner.arch }}
135
199
200
+ - name : Get artifact dir name
201
+ run : node .github/workflows/get_artifact_dir_name.js
202
+
203
+ - name : Download rewatch binary
204
+ uses : actions/download-artifact@v4
205
+ with :
206
+ name : rewatch-${{ env.artifact_dir_name }}
207
+ path : rewatch
208
+
136
209
- name : Make static linux binaries executable
137
210
if : runner.os == 'Linux'
138
211
run : |
139
212
chmod +x ninja/ninja
213
+ chmod +x rewatch/rewatch
140
214
chmod +x _build/install/default/bin/*
141
215
142
216
- name : Use OCaml ${{matrix.ocaml_compiler}}
@@ -252,14 +326,11 @@ jobs:
252
326
KEYCDN_PASSWORD : ${{ secrets.KEYCDN_PASSWORD }}
253
327
run : bash playground/upload_bundle.sh
254
328
255
- - name : Prepare artifact upload
256
- run : node .github/workflows/get_artifact_info.js
257
-
258
329
- name : " Upload artifacts: binaries"
259
330
uses : actions/upload-artifact@v4
260
331
with :
261
- name : ${{ env.artifact_name }}
262
- path : ${{ env.artifact_path }}
332
+ name : binaries- ${{ env.artifact_dir_name }}
333
+ path : ${{ env.artifact_dir_name }}
263
334
264
335
- name : " Upload artifacts: lib/ocaml"
265
336
if : runner.os == 'Linux'
0 commit comments