-
Notifications
You must be signed in to change notification settings - Fork 55
283 lines (264 loc) · 8.94 KB
/
build-release.yml
File metadata and controls
283 lines (264 loc) · 8.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: Build Release
on:
workflow_dispatch:
inputs:
tag_name:
description: "Optional tag name"
required: false
permissions:
id-token: write # Required for OIDC for publishing to npm
contents: read
jobs:
build-ppx-linux:
strategy:
matrix:
platform: [ubuntu-latest]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
container:
image: debian:bullseye
defaults:
run:
working-directory: packages/rescript-relay/rescript-relay-ppx
steps:
- name: Install system dependencies
working-directory: /
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
curl \
ca-certificates \
git \
unzip \
bubblewrap
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 23.x
env:
CI: true
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "4.14"
dune-cache: true
cache-prefix: "v2-bullseye"
- name: Install PPX dependencies
run: opam install . --deps-only
- name: Build PPX
run: |
opam exec -- dune build --profile release-static bin/RescriptRelayPpxApp.exe
- name: Copy built PPX file
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-linux
- name: Strip binary
run: |
chmod +w ppx-linux
strip ppx-linux
- name: Upload PPX artifact
uses: actions/upload-artifact@v4
with:
name: ppx-linux
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-ppx:
strategy:
matrix:
platform: [
macos-15-intel, # x64
macos-15, # ARM,
windows-latest,
]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 23.x
env:
CI: true
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "4.14"
dune-cache: true
cache-prefix: "v1"
- name: Install PPX dependencies
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam install . --deps-only
- name: Build PPX
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
- name: Strip PPX binary
if: runner.os != 'Windows'
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
chmod +w _build/default/bin/RescriptRelayPpxApp.exe
strip _build/default/bin/RescriptRelayPpxApp.exe
- name: Copy built PPX file
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-${{ matrix.platform }}
- name: Upload PPX artifact ${{ matrix.platform }}
uses: actions/upload-artifact@v4
with:
name: ppx-${{ matrix.platform }}
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-compiler:
name: Build Relay Rust Compiler (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-x64
- target: x86_64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-compiler-macos-x64
- target: aarch64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-compiler-macos-arm64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-musl
packages: musl-tools
features: vendored
- target: x86_64-pc-windows-msvc
os: windows-latest
build-name: relay.exe
artifact-name: relay-compiler-win-x64
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2025-05-09
override: true
target: ${{ matrix.target.target }}
- name: Install packages
if: matrix.target.os == 'ubuntu-latest' && matrix.target.packages
run: sudo apt update && sudo apt install ${{ matrix.target.packages }} -y
- uses: actions-rs/cargo@v1
with:
command: build
# add --locked back when we have a better way to ensure it's up to date
args: --manifest-path=packages/relay/compiler/Cargo.toml --release --target ${{ matrix.target.target }} ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.artifact-name }}
path: packages/relay/compiler/target/${{ matrix.target.target }}/release/${{ matrix.target.build-name }}
build-release:
name: Build release package
runs-on: ubuntu-latest
needs: [build-ppx, build-ppx-linux, build-compiler]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 23
env:
CI: true
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "4.14"
dune-cache: true
cache-prefix: "v1"
- name: Install PPX dependencies
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam install . --deps-only
- name: Build PPX
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
- name: Build assets
env:
INPUT_TAG_NAME: ${{ github.event.inputs.tag_name }}
run: |
./build-ci.sh
- name: Download artifact relay-compiler-linux-x64
uses: actions/download-artifact@v4.1.7
with:
name: relay-compiler-linux-x64
path: binaries/relay-compiler-linux-x64
- name: Download artifact relay-compiler-macos-x64
uses: actions/download-artifact@v4.1.7
with:
name: relay-compiler-macos-x64
path: binaries/relay-compiler-macos-x64
- name: Download artifact relay-compiler-macos-arm64
uses: actions/download-artifact@v4.1.7
with:
name: relay-compiler-macos-arm64
path: binaries/relay-compiler-macos-arm64
- name: Download artifact relay-compiler-linux-musl
uses: actions/download-artifact@v4.1.7
with:
name: relay-compiler-linux-musl
path: binaries/relay-compiler-linux-musl
- name: Download artifact relay-compiler-win-x64
uses: actions/download-artifact@v4.1.7
with:
name: relay-compiler-win-x64
path: binaries/relay-compiler-win-x64
- uses: actions/download-artifact@v4.1.7
with:
name: ppx-linux
path: binaries
- uses: actions/download-artifact@v4.1.7
with:
name: ppx-macos-15-intel
path: binaries
- uses: actions/download-artifact@v4.1.7
with:
name: ppx-macos-15
path: binaries
- uses: actions/download-artifact@v4.1.7
with:
name: ppx-windows-latest
path: binaries
- name: Rename MacOS old binary
run: |
mv binaries/ppx-macos-15-intel binaries/ppx-macos-latest
- name: Rename MacOS ARM64 binary
run: |
mv binaries/ppx-macos-15 binaries/ppx-macos-arm64
- name: Move binaries into release directory
run: |
mv binaries/* _release/
- name: Remove artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
ppx-linux
ppx-macos-15-intel
ppx-macos-15
ppx-windows-latest
relay-compiler-linux-x64
relay-compiler-macos-x64
relay-compiler-win-x64
relay-compiler-macos-arm64
relay-compiler-linux-musl
- name: Upload built folder
uses: actions/upload-artifact@v4
with:
name: release-build
path: _release/
- name: Update npm
run: npm install -g npm@latest
- name: Publish to npm with tag ${{ github.event.inputs.tag_name }}
if: ${{ github.event.inputs.tag_name }}
working-directory: _release
run: npm publish --tag ${{ github.event.inputs.tag_name }}
- name: Publish to npm with tag latest
if: ${{ !github.event.inputs.tag_name }}
working-directory: _release
run: npm publish