Skip to content

Commit 7396be3

Browse files
committed
Build static linux binaries
1 parent 3b5824b commit 7396be3

File tree

1 file changed

+59
-12
lines changed

1 file changed

+59
-12
lines changed

.github/workflows/ci.yml

+59-12
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,55 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
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: [
25+
ubuntu-latest, # x64
26+
buildjet-2vcpu-ubuntu-2204-arm # ARM
27+
]
28+
include:
29+
- os: ubuntu-latest
30+
artifact-folder: linux
31+
- os: buildjet-2vcpu-ubuntu-2204-arm
32+
artifact-folder: linuxarm64
33+
34+
runs-on: ${{matrix.os}}
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Build
41+
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.19-ocaml-5.1.1-01
42+
with:
43+
args: opam exec -- make
44+
45+
- name: Compress files
46+
run: |
47+
mkdir ${{matrix.artifact-folder}}
48+
mv rescript-editor-analysis.exe rescript-tools.exe ${{matrix.artifact-folder}}
49+
tar -cvf binary.tar ${{matrix.artifact-folder}}
50+
51+
- name: "Upload artifacts"
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: ${{matrix.artifact-folder}}
55+
path: binary.tar
56+
57+
build:
1658
strategy:
1759
fail-fast: false
1860
matrix:
19-
# Stay on the oldest Ubuntu version that's still supported by Github Actions
20-
# to avoid glibc incompatibilities as far as possible.
2161
os: [
2262
macos-13, # x64
2363
macos-14, # ARM
24-
ubuntu-20.04,
2564
windows-latest,
2665
]
2766
# syntax explanation:
@@ -31,8 +70,6 @@ jobs:
3170
artifact-folder: darwin
3271
- os: macos-14
3372
artifact-folder: darwinarm64
34-
- os: ubuntu-20.04
35-
artifact-folder: linux
3673
- os: windows-latest
3774
artifact-folder: win32
3875

@@ -110,7 +147,9 @@ jobs:
110147
path: binary.tar
111148

112149
package:
113-
needs: test
150+
needs:
151+
- build
152+
- build-linux
114153
runs-on: ubuntu-20.04
115154

116155
steps:
@@ -125,31 +164,39 @@ jobs:
125164
- run: npm ci
126165
- run: npm run compile
127166

128-
- name: Download MacOS binary
167+
- name: Download MacOS binaries
129168
uses: actions/download-artifact@v4
130169
with:
131170
name: macos-13
132171
path: binaries
133172
- run: tar -xvf binary.tar
134173
working-directory: binaries
135174

136-
- name: Download MacOS ARM binary
175+
- name: Download MacOS ARM binaries
137176
uses: actions/download-artifact@v4
138177
with:
139178
name: macos-14
140179
path: binaries
141180
- run: tar -xvf binary.tar
142181
working-directory: binaries
143182

144-
- name: Download Linux binary
183+
- name: Download Linux binaries
184+
uses: actions/download-artifact@v4
185+
with:
186+
name: linux
187+
path: binaries
188+
- run: tar -xvf binary.tar
189+
working-directory: binaries
190+
191+
- name: Download Linux ARM binaries
145192
uses: actions/download-artifact@v4
146193
with:
147-
name: ubuntu-20.04
194+
name: linuxarm64
148195
path: binaries
149196
- run: tar -xvf binary.tar
150197
working-directory: binaries
151198

152-
- name: Download Windows binary
199+
- name: Download Windows binaries
153200
uses: actions/download-artifact@v4
154201
with:
155202
name: windows-latest

0 commit comments

Comments
 (0)