Skip to content

Commit f6b4081

Browse files
authored
build ppx for linux ARM64 (#146)
* build ppx for linux ARM64 * use ocaml/setup-ocaml instead of alpine ocaml because JavaScript Actions in Alpine containers are only supported on x64 Linux runners. * fix artifact name on upload of linux arm ppx * move to setup-ocaml for build linux ppx * move to ocaml 4.14.2 * upgrade ocaml to v5.3.0 * relax dependencies and create dune pkg locks * use dune package manager workflow * use setup dune * Revert "use setup dune" This reverts commit 225dc50. * use opam again * fix ci on windows * downgrade to setup-ocaml@v2 for windows * downgrading ocaml to 5.2.0 on windows * try downgrading to 4.14 on windows * try using [email protected] and windows-2022 * try again with latest windows and setup-ocaml * try running dune build inside a script * add more logs * and more logs again * use ppxlib < 0.35.0 ppxlib 0.35.0 dropped support for ocaml ast <= 4.08 * remove dune pkg lock for now * simplify dependency constraints * disable dune cache for windows * add permissions for E2E test * remove dune_build.sh * fix E2E tests permissions * update contribution instructions for ocaml
1 parent 5e649a3 commit f6b4081

File tree

6 files changed

+78
-27
lines changed

6 files changed

+78
-27
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
sury:
1414
name: Sury - Build & Test & Lint & Pack
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1616
steps:
1717
- uses: actions/checkout@v4
1818
- uses: pnpm/action-setup@v2
@@ -42,22 +42,21 @@ jobs:
4242

4343
ppx-build-linux:
4444
name: ppx-build-linux
45-
runs-on: ubuntu-latest
45+
runs-on: ubuntu-24.04
4646
defaults:
4747
run:
4848
working-directory: packages/sury-ppx/src
4949
strategy:
5050
matrix:
5151
ocaml-compiler:
52-
- 4.12.1
53-
container:
54-
image: ocaml/opam:alpine-3.16-ocaml-4.12
55-
options: --user root
52+
- 5.3.0
5653
steps:
5754
- uses: actions/checkout@v4
5855

59-
- name: Opam init
60-
run: opam init -a --disable-sandboxing --compiler=${{ matrix.ocaml-compiler }}
56+
- name: Use OCaml ${{ matrix.ocaml-compiler}}
57+
uses: ocaml/setup-ocaml@v3
58+
with:
59+
ocaml-compiler: ${{ matrix.ocaml-compiler }}
6160

6261
- name: Install deps
6362
run: opam install . --deps-only --with-test
@@ -72,6 +71,37 @@ jobs:
7271
path: packages/sury-ppx/src/_build/default/bin/bin.exe
7372
if-no-files-found: error
7473

74+
ppx-build-linux-arm:
75+
name: ppx-build-linux-arm
76+
runs-on: ubuntu-24.04-arm
77+
defaults:
78+
run:
79+
working-directory: packages/sury-ppx/src
80+
strategy:
81+
matrix:
82+
ocaml-compiler:
83+
- 5.3.0
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Use OCaml ${{ matrix.ocaml-compiler}}
88+
uses: ocaml/setup-ocaml@v3
89+
with:
90+
ocaml-compiler: ${{ matrix.ocaml-compiler }}
91+
92+
- name: Install deps
93+
run: opam install . --deps-only --with-test
94+
95+
- name: Build
96+
run: opam exec -- dune build --profile static
97+
98+
- name: Upload artifacts
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: ppx-build-linux-arm
102+
path: packages/sury-ppx/src/_build/default/bin/bin.exe
103+
if-no-files-found: error
104+
75105
ppx-build-macos:
76106
name: ppx-build-macos
77107
runs-on: macOS-latest
@@ -81,12 +111,12 @@ jobs:
81111
strategy:
82112
matrix:
83113
ocaml-compiler:
84-
- 4.12.1
114+
- 5.3.0
85115
steps:
86116
- uses: actions/checkout@v4
87117

88118
- name: Use OCaml ${{ matrix.ocaml-compiler}}
89-
uses: ocaml/setup-ocaml@v2
119+
uses: ocaml/setup-ocaml@v3
90120
with:
91121
ocaml-compiler: ${{ matrix.ocaml-compiler }}
92122

@@ -97,7 +127,7 @@ jobs:
97127
run: opam exec -- dune build
98128

99129
- name: Upload artifacts
100-
uses: actions/upload-artifact@master
130+
uses: actions/upload-artifact@v4
101131
with:
102132
name: ppx-build-macos
103133
path: packages/sury-ppx/src/_build/default/bin/bin.exe
@@ -112,12 +142,12 @@ jobs:
112142
strategy:
113143
matrix:
114144
ocaml-compiler:
115-
- 4.12.1
145+
- 5.3.0
116146
steps:
117147
- uses: actions/checkout@v4
118148

119149
- name: Use OCaml ${{ matrix.ocaml-compiler}}
120-
uses: ocaml/setup-ocaml@v2
150+
uses: ocaml/setup-ocaml@v3
121151
with:
122152
ocaml-compiler: ${{ matrix.ocaml-compiler }}
123153

@@ -128,27 +158,27 @@ jobs:
128158
run: opam exec -- dune build
129159

130160
- name: Upload artifacts
131-
uses: actions/upload-artifact@master
161+
uses: actions/upload-artifact@v4
132162
with:
133163
name: ppx-build-macos-x64
134164
path: packages/sury-ppx/src/_build/default/bin/bin.exe
135165
if-no-files-found: error
136166

137167
ppx-build-windows:
138168
name: ppx-build-windows
139-
runs-on: windows-latest
169+
runs-on: windows-2025
140170
defaults:
141171
run:
142172
working-directory: packages/sury-ppx/src
143173
strategy:
144174
matrix:
145175
ocaml-compiler:
146-
- 4.12.1
176+
- 5.3.0
147177
steps:
148178
- uses: actions/checkout@v4
149179

150180
- name: Use OCaml ${{ matrix.ocaml-compiler}}
151-
uses: ocaml/setup-ocaml@v2
181+
uses: ocaml/setup-ocaml@v3
152182
with:
153183
ocaml-compiler: ${{ matrix.ocaml-compiler }}
154184

@@ -159,16 +189,23 @@ jobs:
159189
run: opam exec -- dune build
160190

161191
- name: Upload artifacts
162-
uses: actions/upload-artifact@master
192+
uses: actions/upload-artifact@v4
163193
with:
164194
name: ppx-build-windows
165195
path: packages/sury-ppx/src/_build/default/bin/bin.exe
166196
if-no-files-found: error
167197

168198
pack-sury-ppx:
169199
name: Pack sury-ppx
170-
needs: [ppx-build-linux, ppx-build-macos, ppx-build-macos-x64, ppx-build-windows]
171-
runs-on: ubuntu-latest
200+
needs:
201+
[
202+
ppx-build-linux,
203+
ppx-build-linux-arm,
204+
ppx-build-macos,
205+
ppx-build-macos-x64,
206+
ppx-build-windows,
207+
]
208+
runs-on: ubuntu-24.04
172209
steps:
173210
- uses: actions/checkout@v4
174211
- uses: pnpm/action-setup@v2
@@ -184,6 +221,12 @@ jobs:
184221
name: ppx-build-linux
185222
path: binaries/linux
186223

224+
- name: Download ppx linux-ARM artifacts
225+
uses: actions/download-artifact@v4
226+
with:
227+
name: ppx-build-linux-arm
228+
path: binaries/linux-arm
229+
187230
- name: Download macOS artifacts
188231
uses: actions/download-artifact@master
189232
with:
@@ -205,6 +248,7 @@ jobs:
205248
- name: Move ppx artifacts
206249
run: |
207250
mv binaries/linux/bin.exe packages/sury-ppx/ppx-linux.exe
251+
mv binaries/linux-arm/bin.exe packages/sury-ppx/ppx-linux-arm.exe
208252
mv binaries/macos/bin.exe packages/sury-ppx/ppx-osx.exe
209253
mv binaries/macos-x64/bin.exe packages/sury-ppx/ppx-osx-x64.exe
210254
mv binaries/windows/bin.exe packages/sury-ppx/ppx-windows.exe
@@ -221,8 +265,11 @@ jobs:
221265

222266
e2e:
223267
name: E2E Test
268+
permissions:
269+
contents: write
270+
pull-requests: write
224271
needs: [ppx-build-linux]
225-
runs-on: ubuntu-latest
272+
runs-on: ubuntu-24.04
226273
steps:
227274
- uses: actions/checkout@v4
228275
- uses: pnpm/action-setup@v2

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Make sure running the below commands in `packages/sury-ppx/src`.
2626
1. Create a sandbox with opam
2727

2828
```
29-
opam switch create sury-ppx 4.12.1
29+
opam switch create sury-ppx 5.3.0
3030
```
3131

3232
Or

packages/sury-ppx/install.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const installWindowsBinary = () => {
3535

3636
switch (process.platform) {
3737
case "linux":
38-
installMacLinuxBinary("ppx-linux.exe");
38+
installMacLinuxBinary(
39+
process.arch === "arm64" ? "ppx-linux-arm.exe" : "ppx-linux.exe"
40+
);
3941
break;
4042
case "darwin":
4143
const binaryName =

packages/sury-ppx/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"install.cjs",
2525
"ppx-windows.exe",
2626
"ppx-linux.exe",
27+
"ppx-linux-arm.exe",
2728
"ppx-osx.exe",
2829
"ppx-osx-x64.exe",
2930
"bin.cmd",

packages/sury-ppx/src/dune-project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
(lang dune 2.7)
1+
(lang dune 3.19)
2+
23
(name sury-ppx)

packages/sury-ppx/src/sury-ppx.opam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ homepage: "https://github.com/DZakh/rescript-schema"
1212
bug-reports: "https://github.com/DZakh/rescript-schema/issues"
1313
dev-repo: "git+https://github.com/DZakh/rescript-schema.git"
1414
depends: [
15-
"ocaml" { = "4.12.1"}
16-
"dune" { >= "2.7"}
17-
"ppxlib" { = "0.24.0"}
15+
"ocaml" { >= "4.12.1"}
16+
"dune" { >= "3.19"}
17+
"ppxlib" { = "0.34.0" }
1818
]
1919
build: [
2020
["dune" "build" "-p" name "-j" jobs]

0 commit comments

Comments
 (0)