-
-
Notifications
You must be signed in to change notification settings - Fork 27
379 lines (356 loc) · 14.3 KB
/
onyx-build.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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
name: Build and Test
on:
push:
branches:
- master
pull_request:
branches:
- master
- dev
workflow_dispatch:
inputs:
release:
description: 'Make release'
jobs:
setup:
name: Set up
runs-on: ubuntu-24.04
outputs:
VERSION: ${{ steps.setup.outputs.VERSION }}
DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }}
steps:
- name: Set up environment variables
id: setup
shell: bash
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
DOING_RELEASE=$(echo $VERSION | grep -c '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+\(-\([a-zA-Z]\+\)\?[0-9]*\)\?$' || true)
echo "DOING_RELEASE=${DOING_RELEASE}" >> $GITHUB_OUTPUT
echo $VERSION
echo $DOING_RELEASE
build:
name: Building on ${{ matrix.build }}-${{ matrix.runtime_library }}
runs-on: ${{ matrix.os }}
needs: [ setup ]
strategy:
fail-fast: false
matrix:
include:
- build: linux-amd64
os: ubuntu-24.04
runtime_library: ovmwasm
artifact_name: 'onyx-linux-ovm-amd64'
- build: linux-amd64
os: ubuntu-24.04
runtime_library: wasmer
artifact_name: 'onyx-linux-wasmer-amd64'
- build: linux-amd64
os: ubuntu-24.04
runtime_library: none
artifact_name: 'onyx-linux-none-amd64'
- build: linux-arm64
os: ubuntu-24.04
runtime_library: ovmwasm
artifact_name: 'onyx-linux-ovm-arm64'
- build: linux-arm64
os: ubuntu-24.04
runtime_library: wasmer
artifact_name: 'onyx-linux-wasmer-arm64'
- build: linux-arm64
os: ubuntu-24.04
runtime_library: none
artifact_name: 'onyx-linux-none-arm64'
- build: darwin-arm64
os: macos-13
runtime_library: none
target: aarch64-apple-darwin
artifact_name: 'onyx-darwin-none-arm64'
- build: darwin-arm64
os: macos-13
runtime_library: wasmer
target: aarch64-apple-darwin
artifact_name: 'onyx-darwin-wasmer-arm64'
- build: darwin-amd64
os: macos-13
runtime_library: none
artifact_name: 'onyx-darwin-none-amd64'
- build: darwin-amd64
os: macos-13
runtime_library: wasmer
artifact_name: 'onyx-darwin-wasmer-amd64'
- build: darwin-amd64
os: macos-13
runtime_library: ovmwasm
artifact_name: 'onyx-darwin-ovm-amd64'
- build: darwin-arm64
os: macos-13
runtime_library: ovmwasm
target: aarch64-apple-darwin
artifact_name: 'onyx-darwin-ovm-arm64'
- build: windows-amd64
os: windows-latest
artifact_name: 'onyx-windows-wasmer-amd64'
steps:
- uses: actions/checkout@v3
- name: Setup directory for building
if: matrix.build != 'windows-amd64'
run: |
chmod +x build.sh
- name: Install Wasmer building dependencies (AMD64)
if: (matrix.runtime_library == 'wasmer') && (matrix.build != 'darwin-arm64' && matrix.build != 'linux-arm64')
run: |
curl https://get.wasmer.io -sSfL | sh
echo "$HOME/.wasmer/bin" >> $GITHUB_PATH
# Have to do MacOS ARM64 special, since I don't want to pay for the M1 GitHub runners
# to build this natively. Instead, we directly download the ARM version of WASMER
# and link to its libwasmer.a file.
- name: Install Wasmer building dependencies (LINUX-ARM64)
if: (matrix.runtime_library == 'wasmer') && (matrix.build == 'linux-arm64')
run: |
curl -o wasmer.tar.gz https://github.com/wasmerio/wasmer/releases/download/v4.2.6/wasmer-linux-aarch64.tar.gz -L
mkdir wasmer
tar -C wasmer -zxvf wasmer.tar.gz
# Have to do MacOS ARM64 special, since I don't want to pay for the M1 GitHub runners
# to build this natively. Instead, we directly download the ARM version of WASMER
# and link to its libwasmer.a file.
- name: Install Wasmer building dependencies (DARWIN-ARM64)
if: (matrix.runtime_library == 'wasmer') && (matrix.build == 'darwin-arm64')
run: |
curl -o wasmer.tar.gz https://github.com/wasmerio/wasmer/releases/download/v4.2.6/wasmer-darwin-arm64.tar.gz -L
mkdir wasmer
tar -C wasmer -zxvf wasmer.tar.gz
- name: Install Windows building dependencies
if: matrix.build == 'windows-amd64'
uses: ilammy/msvc-dev-cmd@v1
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-amd64') && (matrix.runtime_library != 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: linux_x86_64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
ONYX_USE_DYNCALL: '1'
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-amd64') && (matrix.runtime_library == 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: linux_x86_64
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-arm64') && (matrix.runtime_library != 'none')
run: |
sudo apt install --yes gcc-aarch64-linux-gnu
./build.sh compile compress
env:
ONYX_CC: aarch64-linux-gnu-gcc
ONYX_ARCH: linux_aarch64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
WASMER_LIB_PATH: ../wasmer/lib
ONYX_USE_DYNCALL: '0'
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'linux-arm64') && (matrix.runtime_library == 'none')
run: |
sudo apt install --yes gcc-aarch64-linux-gnu
./build.sh compile compress
env:
ONYX_CC: aarch64-linux-gnu-gcc
ONYX_ARCH: linux_aarch64
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-amd64') && (matrix.runtime_library != 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_amd64
ONYX_RUNTIME_LIBRARY: ${{ matrix.runtime_library }}
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-amd64') && (matrix.runtime_library == 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_amd64
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'wasmer')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_arm64
ONYX_TARGET: aarch64-apple-darwin
WASMER_LIB_PATH: ../wasmer/lib
ONYX_RUNTIME_LIBRARY: wasmer
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'ovmwasm')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_arm64
ONYX_TARGET: aarch64-apple-darwin
ONYX_RUNTIME_LIBRARY: ovmwasm
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: (matrix.build == 'darwin-arm64') && (matrix.runtime_library == 'none')
run: |
./build.sh compile compress
env:
ONYX_CC: gcc
ONYX_ARCH: darwin_arm64
ONYX_TARGET: aarch64-apple-darwin
- name: Build Onyx for ${{ matrix.build }}-${{ matrix.runtime_library }}
if: matrix.build == 'windows-amd64'
run: |
cmd.exe /c 'build.bat dist'
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist
if-no-files-found: error
retention-days: 5
# test:
# needs: [setup, build]
# runs-on: ubuntu-latest
# steps:
# - name: Download artifacts
release:
needs: [setup, build]
runs-on: ubuntu-latest
if: needs.setup.outputs.DOING_RELEASE == '1' || github.event.inputs.release != ''
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.VERSION }}
release_name: Release ${{ needs.setup.outputs.VERSION }}
draft: true
prerelease: false
- name: Upload Release Asset Linux AMD64 with OVM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-ovm-amd64/onyx.tar.gz
asset_name: onyx-linux-ovm-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux AMD64 with Wasmer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-wasmer-amd64/onyx.tar.gz
asset_name: onyx-linux-wasmer-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux AMD64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-none-amd64/onyx.tar.gz
asset_name: onyx-linux-none-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux ARM64 with OVM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-ovm-arm64/onyx.tar.gz
asset_name: onyx-linux-ovm-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux ARM64 with Wasmer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-wasmer-arm64/onyx.tar.gz
asset_name: onyx-linux-wasmer-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Linux ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-linux-none-arm64/onyx.tar.gz
asset_name: onyx-linux-none-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS AMD64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-none-amd64/onyx.tar.gz
asset_name: onyx-darwin-none-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS ARM64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-none-arm64/onyx.tar.gz
asset_name: onyx-darwin-none-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS AMD64 (Wasmser)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-wasmer-amd64/onyx.tar.gz
asset_name: onyx-darwin-wasmer-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS ARM64 (Wasmer)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-wasmer-arm64/onyx.tar.gz
asset_name: onyx-darwin-wasmer-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS AMD64 (OVMwasm)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-ovm-amd64/onyx.tar.gz
asset_name: onyx-darwin-ovm-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset MacOS ARM64 (OVMwasm)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-darwin-ovm-arm64/onyx.tar.gz
asset_name: onyx-darwin-ovm-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset Window X64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/onyx-windows-wasmer-amd64/onyx.zip
asset_name: onyx-windows-wasmer-amd64.zip
asset_content_type: application/zip