-
-
Notifications
You must be signed in to change notification settings - Fork 64
585 lines (561 loc) · 17.5 KB
/
main.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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
name: zenroom
on:
push:
paths-ignore:
- 'docs/**'
- 'examples/**'
- '*.md'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- 'examples/**'
- '*.md'
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
reuse:
name: 🚨 REUSE Compliance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: fsfe/reuse-action@v4
c-lint:
name: 🚨 C lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-cpplint@master
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
targets: --recursive src
level: warning
flags: --linelength=120 # Optional
filter: "-readability/braces\
,-readability/casting\
,-whitespace/comma\
,-whitespace/braces\
,-whitespace/comments\
,-whitespace/indent\
,-whitespace/newline\
,-whitespace/operators\
,-whitespace/parens\
,-whitespace/tab\
" # Optional
# - name: Fail fast?!
# if: steps.linter.outputs.checks-failed > 0
# run: |
# echo "😤 Some files failed the C linting checks!"
lua-lint:
name: 🚨 Lua lint
runs-on: ubuntu-latest
steps:
# - uses: dorny/paths-filter@v2
# with:
# filters: |
# src:
# - 'src/lua'
# - if: steps.changes.outputs.src == 'true'
- uses: actions/checkout@v4
- name: Setup luacheck
run: |
if ! hash luacheck &>/dev/null; then
sudo apt-get install -yq luarocks 1>/dev/null || exit 1
sudo luarocks install luacheck 1>/dev/null || exit 1
sudo luarocks install lanes &>/dev/null || true
fi
luacheck --version
shell: bash
- name: 🚨 LUA lint
continue-on-error: true
working-directory: src/lua
run: |
luacheck --config .luacheckrc --std lua54 .
linux-test:
name: 🐧 Linux check tests (gcc and clang)
needs: [reuse, c-lint, lua-lint]
strategy:
matrix:
command: [COMPILER=gcc, COMPILER=clang]
fail-fast: false
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: hendrikmuhs/ccache-action@v1.2
- name: install dependencies
run: |
sudo apt install -yq jq libreadline-dev
${{ matrix.command }} sudo apt install -yq $COMPILER
pip3 install --prefer-binary meson ninja
- name: Build GNU/Linux ${{ matrix.command }}
run: |
make linux-exe ${{ matrix.command }}
make -C src clean
make linux-lib ${{ matrix.command }}
- name: Check all tests on ${{ matrix.command }}
run: |
make check
windows-build:
name: 🪟 Windows build test
needs: [reuse, c-lint, lua-lint]
if: "github.event_name == 'pull_request'"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hendrikmuhs/ccache-action@v1.2
- name: install dependencies
run : |
sudo apt install -y jq gcc-mingw-w64
- name: Build x86_64 windows .exe
run: |
make win-exe CCACHE=1
make clean -C src
make win-dll CCACHE=1
osx-test:
name: 🍎 Apple OSX check tests
needs: [reuse, c-lint, lua-lint]
if: "github.event_name == 'pull_request'"
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
pip3 install --prefer-binary meson ninja
- uses: hendrikmuhs/ccache-action@v1.2
- run: |
make osx-exe CCACHE=1
make -C src clean
make osx-lib CCACHE=1
otool -hv libzenroom.dylib
make check-osx
arm32-test:
name: 🦾 ARM32 build test
needs: [reuse, c-lint, lua-lint]
if: "github.event_name == 'pull_request'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pguyot/arm-runner-action@v2
with:
commands: |
sudo apt-get update -yq
sudo apt-get install -yq --no-install-recommends make cmake gcc jq libreadline-dev xxd git python3-venv
make linux-exe
# Testing on ARM32 in Qemu takes too long. This should be tested on-site
# python3 -m venv .venv
# . .venv/bin/activate && pip install --prefer-binary meson ninja
# make check
go-build-check:
name: 🐹 go build & checks
needs: [reuse, c-lint, lua-lint]
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'SKIP_GO') && github.event_name == 'pull_request'"
strategy:
matrix:
go: ['stable','oldstable']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hendrikmuhs/ccache-action@v1.2
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
pip3 install --prefer-binary meson ninja
sudo apt-get install -qy libreadline-dev
- run: |
make linux-exe CCACHE=1
cp zencode-exec /usr/local/bin/
- name: 🧪 test bindings go-${{ matrix.go }}
working-directory: bindings/golang/zenroom
run: make test
# - name: 🔐 check crypto with go-${{ matrix.go }}
# run: make check-go
rust-build-check:
name: 🦀 rust build & checks
needs: [reuse, c-lint, lua-lint]
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'SKIP_RUST') && github.event_name == 'pull_request'"
strategy:
matrix:
rust: ['stable', 'nightly']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hendrikmuhs/ccache-action@v1.2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
pip3 install --prefer-binary meson ninja
sudo apt-get install -qy libreadline-dev
- run: |
make linux-exe CCACHE=1
cp zencode-exec /usr/local/bin/
- name: 🧪 test bindings rust-${{ matrix.rust }}
working-directory: bindings/rust
run: cargo test
- name: 🔐 check crypto with rust-${{ matrix.rust }}
run: make check-rs
js-build-check:
name: 🐯 NodeJS WASM check tests
needs: [reuse, c-lint, lua-lint]
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'SKIP_JS') && github.event_name == 'pull_request'"
strategy:
matrix:
node-version: [20.18.0]
env:
EM_VERSION: 3.1.71
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EM_VERSION }}
- name: Install dependencies
run: |
pip3 install --prefer-binary meson ninja
- name: Build Zenroom Wasm
run: |
make node-wasm CCACHE=1
env:
EMSCRIPTEN: ${{ env.EMSDK }}/upstream/emscripten
- name: 🧪 test zencode with node-${{ matrix.node-version }}
run: |
make check-js
python-check:
name: 🐍 Python checks
needs: [reuse, c-lint, lua-lint]
if: "!contains(github.event.pull_request.labels.*.name, 'SKIP_PY') && github.event_name == 'pull_request'"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: bindings/python3
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies on Linux
run: |
sudo apt update
sudo apt install -yq cmake libreadline-dev
if: runner.os == 'Linux'
- name: Build zencode-exec on Linux
run: |
cd ../..
make linux-exe RELEASE=1
cp zencode-exec /usr/local/bin/
if: runner.os == 'Linux'
- name: Build zencode-exec on Apple/OSX
run: |
cd ../..
make osx-exe RELEASE=1
cp zencode-exec.command /usr/local/bin/zencode-exec
if: runner.os == 'macOS'
- run: |
./prepare.sh
pipx install meson
pipx install ninja
pip3 install .[test]
- run: pytest -s tests
semantic-release:
name: 🤖 Semantic release
needs: [linux-test]
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'master' && github.event_name == 'push' }}
outputs:
release: ${{ steps.tag_release.outputs.release }}
version: ${{ steps.tag_release.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn
- name: Tag release
id: tag_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release | tee semantic-release.log
if [[ `git tag --points-at HEAD` == "" ]]; then
echo "release=False" >> $GITHUB_OUTPUT
else
echo "release=True" >> $GITHUB_OUTPUT
awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT
fi
js-build-release:
name: 🐯 js build release
needs: [semantic-release]
if: ${{ needs.semantic-release.outputs.release == 'True' }}
runs-on: ubuntu-latest
env:
EM_VERSION: 3.1.71
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.18.0
- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EM_VERSION }}
- name: Build Zenroom Wasm
run: |
make node-wasm RELEASE=1 CCACHE=1
env:
EMSCRIPTEN: ${{ env.EMSDK }}/upstream/emscripten
- uses: actions/upload-artifact@v4
with:
name: javascript-artifact
path: |
./bindings/javascript/CHANGELOG.md
./bindings/javascript/LICENSE
./bindings/javascript/package.json
./bindings/javascript/README.md
./bindings/javascript/dist/
build-release-on-ubuntu:
name: 🐧 Binary builds on Ubuntu
runs-on: ubuntu-latest
needs: [semantic-release]
if: ${{ needs.semantic-release.outputs.release == 'True' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Upload release docs artifacts
uses: actions/upload-artifact@v4
with:
name: documentation
path: |
build/release-intro.md
- name: Install build deps
run: |
sudo apt install -qy tree jq cmake make gcc musl-tools musl-dev gcc-mingw-w64 libreadline-dev ccache
- name: Build x86_64 with musl-system
run: |
make musl RELEASE=1 CCACHE=1
- name: Upload artifact linux-amd64
uses: actions/upload-artifact@v4
with:
name: release-bin-linux-amd64
path: |
zenroom
zencode-exec
- name: Clean for next build
run: |
make clean
- name: Build x86_64 shlib
run: |
make linux-lib RELEASE=1 CCACHE=1
- name: Upload artifact linux-lib-amd64
uses: actions/upload-artifact@v4
with:
name: release-lib-linux-amd64
path: |
libzenroom.so
- name: Clean for next build
run: make clean
- name: Build x86_64 windows .exe
run: |
make win-exe RELEASE=1 CCACHE=1
make clean -C src
make win-dll RELEASE=1 CCACHE=1
- name: Upload artifact win x86_64
uses: actions/upload-artifact@v4
with:
name: release-exe-win-w64
path: |
zenroom.exe
zencode-exec.exe
libzenroom_dll.lib
zenroom.dll
file-changes:
name: "🗃️ Check file changes"
runs-on: ubuntu-latest
needs: [semantic-release]
if: "needs.semantic-release.outputs.release == 'True'"
outputs:
python3: ${{ steps.filter.outputs.python3 }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python3:
- 'bindings/python3/**'
python-sdist:
name: 🐍 Python create source distribution
runs-on: ubuntu-latest
needs: [semantic-release, file-changes]
if: "needs.semantic-release.outputs.release == 'True' && needs.file-changes.outputs.python3 == 'true'"
defaults:
run:
working-directory: bindings/python3
steps:
- uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
- run: |
pip install --prefer-binary ninja twine
./prepare.sh
- run: pipx run build --sdist
- run: twine check dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
path: ./bindings/python3/dist/*.tar.gz
build-release-on-osx:
name: 🍎 mac osx release build
needs: [semantic-release]
runs-on: macos-latest
if: ${{ needs.semantic-release.outputs.release == 'True' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hendrikmuhs/ccache-action@v1.2
- run: |
make osx-exe RELEASE=1 CCACHE=1
make -C src clean
make osx-lib RELEASE=1 CCACHE=1
- name: Upload artifacts for Apple OSX
uses: actions/upload-artifact@v4
with:
name: release-apple-osx
path: |
zenroom.command
zencode-exec.command
libzenroom.dylib
npm-release:
name: 📦 npm release
runs-on: ubuntu-latest
needs: [js-build-release, build-release-on-osx, build-release-on-ubuntu]
steps:
- uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
with:
name: javascript-artifact
path: .
- run: |
version=$(git describe --tags --abbrev=0)
yarn version --new-version ${version:1} --no-git-tag-version
- run: npm publish . --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
pypi-release:
name: 📦 PyPI release
needs: [js-build-release, python-sdist, build-release-on-osx, build-release-on-ubuntu]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
draft-binary-release:
name: 📦 Pack release
needs: [semantic-release, js-build-release, build-release-on-osx, build-release-on-ubuntu]
runs-on: ubuntu-latest
steps:
- name: download binary artifacts
uses: actions/download-artifact@v4
with:
path: |
zenroom-bin
- name: show directory structure
run: tree -dL 3
- name: relase all binary artifacts
uses: softprops/action-gh-release@v2
with:
files: |
zenroom-bin/release*/*
tag_name: ${{ needs.semantic-release.outputs.version }}
body_path: zenroom-bin/documentation/release-intro.md
append_body: true
draft: false
prerelease: false
fail_on_unmatched_files: true
generate_release_notes: true
publish_docker_image:
name: 🐳 Publish Docker image
needs: [semantic-release, js-build-release, build-release-on-osx, build-release-on-ubuntu]
uses: ForkbombEu/workflows/.github/workflows/publish-ghcr.yml@main
secrets: inherit
remove-tag-on-fail:
name: 🧻 Remove tag on fail
needs: [semantic-release, js-build-release, build-release-on-osx, build-release-on-ubuntu]
runs-on: ubuntu-latest
if: ${{ (failure() || cancelled()) && needs.semantic-release.outputs.release == 'True' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Remove tag
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: ${{ needs.semantic-release.outputs.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: false
repo: dyne/zenroom