@@ -12,16 +12,57 @@ concurrency:
12
12
cancel-in-progress : true
13
13
14
14
jobs :
15
- test :
15
+ # Build statically linked Linux binaries in an Alpine-based Docker container
16
+ # See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
17
+ # for more info.
18
+ # The container already comes with all required tools pre-installed
19
+ # (see https://github.com/rescript-lang/docker-rescript-ci-build/blob/main/Dockerfile).
20
+ build-linux :
21
+ strategy :
22
+ fail-fast : false
23
+ matrix :
24
+ os : [ubuntu-latest, buildjet-2vcpu-ubuntu-2204-arm]
25
+ # syntax explanation:
26
+ # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
27
+ include :
28
+ - os : ubuntu-latest
29
+ artifact-folder : linux
30
+ - os : buildjet-2vcpu-ubuntu-2204-arm
31
+ artifact-folder : linuxarm64
32
+
33
+ runs-on : ${{matrix.os}}
34
+
35
+ steps :
36
+ - name : Checkout
37
+ uses : actions/checkout@v4
38
+
39
+ - name : Build
40
+ uses : docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.19-ocaml-5.1.1-01
41
+ with :
42
+ args : opam exec -- make
43
+
44
+ # Also avoids artifacts upload permission loss:
45
+ # https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss
46
+ - name : Compress files
47
+ run : |
48
+ mkdir ${{matrix.artifact-folder}}
49
+ mv rescript-editor-analysis.exe ${{matrix.artifact-folder}}
50
+ mv rescript-tools.exe ${{matrix.artifact-folder}}
51
+ tar -cvf binary.tar ${{matrix.artifact-folder}}
52
+
53
+ - name : " Upload artifacts"
54
+ uses : actions/upload-artifact@v4
55
+ with :
56
+ name : ${{matrix.artifact-folder}}
57
+ path : binary.tar
58
+
59
+ build :
16
60
strategy :
17
61
fail-fast : false
18
62
matrix :
19
- # Stay on the oldest Ubuntu version that's still supported by Github Actions
20
- # to avoid glibc incompatibilities as far as possible.
21
63
os : [
22
64
macos-13, # x64
23
65
macos-14, # ARM
24
- ubuntu-20.04,
25
66
windows-latest,
26
67
]
27
68
# syntax explanation:
31
72
artifact-folder : darwin
32
73
- os : macos-14
33
74
artifact-folder : darwinarm64
34
- - os : ubuntu-20.04
35
- artifact-folder : linux
36
75
- os : windows-latest
37
76
artifact-folder : win32
38
77
@@ -106,12 +145,14 @@ jobs:
106
145
107
146
- uses : actions/upload-artifact@v4
108
147
with :
109
- name : ${{matrix.os }}
148
+ name : ${{matrix.artifact-folder }}
110
149
path : binary.tar
111
150
112
151
package :
113
- needs : test
114
- runs-on : ubuntu-20.04
152
+ needs :
153
+ - build
154
+ - build-linux
155
+ runs-on : ubuntu-latest
115
156
116
157
steps :
117
158
- uses : actions/checkout@v4
@@ -125,34 +166,42 @@ jobs:
125
166
- run : npm ci
126
167
- run : npm run compile
127
168
128
- - name : Download MacOS binary
169
+ - name : Download MacOS binaries
170
+ uses : actions/download-artifact@v4
171
+ with :
172
+ name : darwin
173
+ path : binaries
174
+ - run : tar -xvf binary.tar
175
+ working-directory : binaries
176
+
177
+ - name : Download MacOS ARM binaries
129
178
uses : actions/download-artifact@v4
130
179
with :
131
- name : macos-13
180
+ name : darwinarm64
132
181
path : binaries
133
182
- run : tar -xvf binary.tar
134
183
working-directory : binaries
135
184
136
- - name : Download MacOS ARM binary
185
+ - name : Download Linux binaries
137
186
uses : actions/download-artifact@v4
138
187
with :
139
- name : macos-14
188
+ name : linux
140
189
path : binaries
141
190
- run : tar -xvf binary.tar
142
191
working-directory : binaries
143
192
144
- - name : Download Linux binary
193
+ - name : Download Linux ARM binaries
145
194
uses : actions/download-artifact@v4
146
195
with :
147
- name : ubuntu-20.04
196
+ name : linuxarm64
148
197
path : binaries
149
198
- run : tar -xvf binary.tar
150
199
working-directory : binaries
151
200
152
- - name : Download Windows binary
201
+ - name : Download Windows binaries
153
202
uses : actions/download-artifact@v4
154
203
with :
155
- name : windows-latest
204
+ name : win32
156
205
path : binaries
157
206
- run : tar -xvf binary.tar
158
207
working-directory : binaries
@@ -163,7 +212,7 @@ jobs:
163
212
164
213
- name : Move binaries to folders
165
214
run : |
166
- declare -a platforms=("darwin" "darwinarm64" "linux" "win32")
215
+ declare -a platforms=("darwin" "darwinarm64" "linux" "linuxarm64" " win32")
167
216
168
217
for platform in "${platforms[@]}"; do
169
218
mkdir server/analysis_binaries/"$platform"
0 commit comments