-
Notifications
You must be signed in to change notification settings - Fork 53
261 lines (243 loc) · 8.2 KB
/
build-release.yml
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
name: Build Release
on:
workflow_dispatch:
inputs:
tag_name:
description: "Optional tag name"
required: false
jobs:
build-ppx-linux:
strategy:
matrix:
platform: [ubuntu-latest]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
defaults:
run:
working-directory: packages/rescript-relay/rescript-relay-ppx
container:
image: alexfedoseev/alpine-node-yarn-esy:0.0.9
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
env:
CI: true
- name: Esy install
run: esy install
- name: Print esy cache
id: print_esy_cache
run: node $GITHUB_WORKSPACE/.github/workflows/print_esy_cache.js
- name: Try to restore dependencies cache
uses: actions/cache@v2
id: deps-cache
with:
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: ${{ matrix.platform }}---v1${{ hashFiles('**/index.json') }}
restore-keys: |
${{ matrix.platform }}---v1
- name: Build PPX
run: esy linux-release-static
- name: Copy built PPX file
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-linux
- name: Strip binary
run: |
strip ppx-linux
- name: Upload PPX artifact
uses: actions/upload-artifact@v2
with:
name: ppx-linux
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-ppx:
strategy:
matrix:
platform: [
macos-13, # x64
macos-14, # ARM,
windows-latest,
]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
env:
CI: true
- name: Install esy
run: npm install -g esy
- name: Build PPX
uses: esy/github-action@master
with:
cache-key: ${{ matrix.platform }}-${{ hashFiles('esy.lock/index.json') }}-v4
working-directory: packages/rescript-relay/rescript-relay-ppx
- name: Strip PPX binary
if: runner.os != 'Windows'
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
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@v2
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-20.04
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@v2
with:
submodules: "true"
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.76.0
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@v2
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@v2
- uses: actions/setup-node@v2-beta
with:
node-version: 20
env:
CI: true
- name: Install esy
run: npm install -g esy
- name: Build PPX
uses: esy/github-action@v1
with:
cache-key: ${{ hashFiles('esy.lock/index.json') }}
working-directory: packages/rescript-relay/rescript-relay-ppx
- 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@v2
with:
name: relay-compiler-linux-x64
path: binaries/relay-compiler-linux-x64
- name: Download artifact relay-compiler-macos-x64
uses: actions/download-artifact@v2
with:
name: relay-compiler-macos-x64
path: binaries/relay-compiler-macos-x64
- name: Download artifact relay-compiler-macos-arm64
uses: actions/download-artifact@v2
with:
name: relay-compiler-macos-arm64
path: binaries/relay-compiler-macos-arm64
- name: Download artifact relay-compiler-linux-musl
uses: actions/download-artifact@v2
with:
name: relay-compiler-linux-musl
path: binaries/relay-compiler-linux-musl
- name: Download artifact relay-compiler-win-x64
uses: actions/download-artifact@v2
with:
name: relay-compiler-win-x64
path: binaries/relay-compiler-win-x64
- uses: actions/download-artifact@v2
with:
name: ppx-linux
path: binaries
- uses: actions/download-artifact@v2
with:
name: ppx-macos-13
path: binaries
- uses: actions/download-artifact@v2
with:
name: ppx-macos-14
path: binaries
- uses: actions/download-artifact@v2
with:
name: ppx-windows-latest
path: binaries
- name: Rename MacOS old binary
run: |
mv binaries/ppx-macos-13 binaries/ppx-macos-latest
- name: Rename MacOS ARM64 binary
run: |
mv binaries/ppx-macos-14 binaries/ppx-macos-arm64
- name: Move binaries into release directory
run: |
mv binaries/* _release/
- name: Remove artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: |
ppx-linux
ppx-macos-13
ppx-macos-14
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@v2
with:
name: release-build
path: _release/
- uses: JS-DevTools/npm-publish@v1
if: ${{ github.event.inputs.tag_name }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./_release/package.json
tag: ${{ github.event.inputs.tag_name }}
- uses: JS-DevTools/npm-publish@v1
if: ${{ !github.event.inputs.tag_name }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./_release/package.json