-
Notifications
You must be signed in to change notification settings - Fork 48
486 lines (438 loc) · 14.7 KB
/
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
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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
name: WasmCloud Release
on:
push:
branches: [main]
tags: ["v*"] # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch: # Allow manual creation of artifacts without a release
pull_request:
branches: [main]
jobs:
erts-linux:
strategy:
matrix:
target:
- aarch64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-gnu
name: erts-${{ matrix.target }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build ERTS
run: nix build -L .#erts-${{ matrix.target }}-fhs
- run: cp $(readlink ./result) erts.tar.gz
- uses: actions/upload-artifact@v3
with:
name: erts-${{ matrix.target }}
path: erts.tar.gz
if-no-files-found: error
nif-darwin:
strategy:
matrix:
target:
- aarch64-apple-darwin
- x86_64-apple-darwin
name: nif-${{ matrix.target }}
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- run: rustup toolchain install stable --profile minimal
- run: rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
if: ${{ !startswith(github.ref, 'refs/tags/') }} # Do not cache on tag pushes
with:
workspaces: "host_core/native/hostcore_wasmcloud_native"
- name: Build NIF
run: |
cd ./host_core/native/hostcore_wasmcloud_native
cargo build --target ${{ matrix.target }} --release
- uses: actions/upload-artifact@v3
with:
name: nif-${{ matrix.target }}
path: ./host_core/native/hostcore_wasmcloud_native/target/${{ matrix.target }}/release/libhostcore_wasmcloud_native.dylib
if-no-files-found: error
nif-linux:
strategy:
matrix:
target:
- aarch64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-gnu
name: nif-${{ matrix.target }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build NIF
run: nix build -L .#hostcore_wasmcloud_native-${{ matrix.target }}-fhs
- uses: actions/upload-artifact@v3
with:
name: nif-${{ matrix.target }}
path: ./result/lib/libhostcore_wasmcloud_native.so
if-no-files-found: error
nif-windows:
name: nif-x86_64-pc-windows-msvc
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
if: ${{ !startswith(github.ref, 'refs/tags/') }} # Do not cache on tag pushes
with:
workspaces: "host_core/native/hostcore_wasmcloud_native"
- name: Build NIF
run: |
cd ./host_core/native/hostcore_wasmcloud_native
cargo build --release
- uses: actions/upload-artifact@v3
with:
name: nif-x86_64-pc-windows-msvc
path: host_core/native/hostcore_wasmcloud_native/target/release/hostcore_wasmcloud_native.dll
if-no-files-found: error
burrito-darwin:
strategy:
matrix:
config:
- package: host_core
arch: aarch64
- package: host_core
arch: x86_64
- package: wasmcloud_host
arch: aarch64
- package: wasmcloud_host
arch: x86_64
needs:
- nif-darwin
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/download-artifact@v3
with:
path: /tmp/nif/lib
name: nif-${{ matrix.config.arch }}-apple-darwin
- name: Wrap ${{ matrix.config.package }} ${{ matrix.config.arch }} Darwin burrito
env:
SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }}
run: |
nix build \
--impure \
--override-input hostcore_wasmcloud_native-${{ matrix.config.arch }}-apple-darwin-mac /tmp/nif \
-L .#${{ matrix.config.package }}-burrito-${{ matrix.config.arch }}-darwin
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.package }}_${{ matrix.config.arch }}_darwin
path: ./result/bin/${{ matrix.config.package }}_${{ matrix.config.arch }}_darwin
if-no-files-found: error
burrito-linux:
strategy:
matrix:
config:
- package: host_core
arch: aarch64
libc: gnu
- package: host_core
arch: aarch64
libc: musl
- package: host_core
arch: x86_64
libc: gnu
- package: host_core
arch: x86_64
libc: musl
- package: wasmcloud_host
arch: aarch64
libc: gnu
- package: wasmcloud_host
arch: aarch64
libc: musl
- package: wasmcloud_host
arch: x86_64
libc: gnu
- package: wasmcloud_host
arch: x86_64
libc: musl
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Wrap ${{ matrix.config.package }} ${{ matrix.config.arch }} Linux ${{ matrix.config.libc }} burrito
env:
SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }}
run: |
nix build \
--impure \
-L .#${{ matrix.config.package }}-burrito-${{ matrix.config.arch }}-linux-${{ matrix.config.libc }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.package }}_${{ matrix.config.arch }}_linux_${{ matrix.config.libc }}
path: ./result/bin/${{ matrix.config.package }}_${{ matrix.config.arch }}_linux_${{ matrix.config.libc }}
if-no-files-found: error
burrito-windows:
strategy:
matrix:
package:
- host_core
- wasmcloud_host
needs:
- nif-windows
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/download-artifact@v3
with:
path: /tmp/nif/lib
name: nif-x86_64-pc-windows-msvc
- name: Wrap ${{ matrix.package }} x86_64 Windows burrito
env:
SECRET_KEY_BASE: ${{ secrets.WASMCLOUD_HOST_SECRET_KEY_BASE }}
run: |
nix build \
--impure \
--override-input hostcore_wasmcloud_native-x86_64-pc-windows-msvc /tmp/nif \
-L .#${{ matrix.package }}-burrito-x86_64-windows
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.package }}_x86_64_windows
path: ./result/bin/${{ matrix.package }}_x86_64_windows.exe
if-no-files-found: error
test-darwin:
strategy:
matrix:
os:
- macos-11
- macos-12
- macos-13
runs-on: ${{ matrix.os }}
needs:
- burrito-darwin
steps:
- run: curl -sL 'https://github.com/nats-io/nats-server/releases/download/v2.9.16/nats-server-v2.9.16-darwin-amd64.tar.gz' | tar xzv --strip-components 1
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_darwin
- run: chmod +x ./host_core_x86_64_darwin
- run: |
./nats-server &
./host_core_x86_64_darwin & sleep 30; kill $!
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_darwin
- run: chmod +x ./wasmcloud_host_x86_64_darwin
- run: |
./nats-server &
./wasmcloud_host_x86_64_darwin & sleep 30; kill $!
test-linux:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
runs-on: ${{ matrix.os }}
needs:
- burrito-linux
services:
nats:
image: nats
ports:
- 4222:4222
steps:
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_linux_gnu
- run: chmod +x ./host_core_x86_64_linux_gnu
- run: ./host_core_x86_64_linux_gnu & sleep 30; kill $!
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_linux_gnu
- run: chmod +x ./wasmcloud_host_x86_64_linux_gnu
- run: ./wasmcloud_host_x86_64_linux_gnu & sleep 30; kill $!
test-windows:
strategy:
matrix:
os:
- windows-2019
- windows-2022
runs-on: ${{ matrix.os }}
needs:
- burrito-windows
steps:
- run: curl -sLo 'nats.tar.gz' 'https://github.com/nats-io/nats-server/releases/download/v2.9.16/nats-server-v2.9.16-windows-amd64.tar.gz'
- run: tar xzvf nats.tar.gz --strip-components 1
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_windows
- run: |
Start-Process ./nats-server.exe
Start-Process ./host_core_x86_64_windows.exe
timeout /t 30
Taskkill /im host_core_x86_64_windows.exe /f
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_windows
- run: |
Start-Process ./nats-server.exe
Start-Process ./wasmcloud_host_x86_64_windows.exe
timeout /t 30
Taskkill /im wasmcloud_host_x86_64_windows.exe /f
release:
# TODO: Build on PRs and pushes to main (but do not push)
# This is currently blocked on the `app-version` computation, which only supports semver tags
# E.g.:
# ```
# Error: buildx failed with: ERROR: invalid tag "wasmcloud.azurecr.io/wasmcloud_host:616/merge": invalid reference format
# ```
if: startswith(github.ref, 'refs/tags/')
strategy:
matrix:
app-name:
- host_core
- wasmcloud_host
runs-on: ubuntu-22.04
needs:
- test-darwin
- test-linux
- test-windows
steps:
- uses: actions/checkout@v3
- name: Determine version
run: echo "app-version=${GITHUB_REF_NAME#v}" > $GITHUB_ENV
- name: Login to AzureCR
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.AZURECR_PUSH_URL }}
username: ${{ secrets.AZURECR_PUSH_USER }}
password: ${{ secrets.AZURECR_PUSH_PASSWORD }}
- name: Login to DockerHub
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_PUSH_USER }}
password: ${{ secrets.DOCKERHUB_PUSH_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx-builder
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.app-name }}_aarch64_linux_gnu
path: ${{ matrix.app-name }}
- run: chmod +x ${{ matrix.app-name }}/${{ matrix.app-name }}_aarch64_linux_gnu
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.app-name }}_x86_64_linux_gnu
path: ${{ matrix.app-name }}
- run: chmod +x ${{ matrix.app-name }}/${{ matrix.app-name }}_x86_64_linux_gnu
- name: Build and release docker image
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx-builder.outputs.name }}
push: ${{ startswith(github.ref, 'refs/tags/') }}
context: ${{ matrix.app-name }}
file: ${{ matrix.app-name }}/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
BIN_ARM64=${{ matrix.app-name }}_aarch64_linux_gnu
BIN_AMD64=${{ matrix.app-name }}_x86_64_linux_gnu
tags: |
wasmcloud.azurecr.io/${{ matrix.app-name }}:${{ env.app-version }}
wasmcloud/${{ matrix.app-name }}:${{ env.app-version }}
wasmcloud.azurecr.io/${{ matrix.app-name }}:latest
wasmcloud/${{ matrix.app-name }}:latest
github-release:
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs:
- release
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v3
with:
name: host_core_aarch64_darwin
- uses: actions/download-artifact@v3
with:
name: host_core_aarch64_linux_gnu
- uses: actions/download-artifact@v3
with:
name: host_core_aarch64_linux_musl
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_darwin
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_linux_gnu
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_linux_musl
- uses: actions/download-artifact@v3
with:
name: host_core_x86_64_windows
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_aarch64_darwin
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_aarch64_linux_gnu
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_aarch64_linux_musl
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_darwin
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_linux_gnu
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_linux_musl
- uses: actions/download-artifact@v3
with:
name: wasmcloud_host_x86_64_windows
- run: chmod +x ./host_core_*
- run: chmod +x ./wasmcloud_host_*
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./host_core_*
./wasmcloud_host_*
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
draft: false
release-charts:
if: ${{ (startswith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && startswith(github.repository.name, 'wasmcloud') }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.7.1
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: wasmcloud_host
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"