Skip to content

Commit 5f3b502

Browse files
committed
feat: add support for linux arm64
- add a release dry run - manually trigger by starting the workflow - verify-prebuilds - is now actually verifies that all binaries are present before publishing - releases can still be triggered by tag pushes - mac x64 gh runners are not free -- we cross-compile from mac arm64
1 parent 3f069ab commit 5f3b502

1 file changed

Lines changed: 44 additions & 10 deletions

File tree

.github/workflows/release.yaml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ jobs:
1313
contents: read
1414
strategy:
1515
matrix:
16-
os: [ubuntu-latest, macos-latest, windows-latest]
17-
opts: [""]
16+
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
17+
arch: [""]
1818
include:
19+
# macos-latest is arm64; cross-compile for x64 too
1920
- os: macos-latest
20-
opts: "--arch arm64"
21+
arch: "--arch x86_64"
2122
runs-on: ${{ matrix.os }}
2223
steps:
2324
- name: checkout
@@ -34,19 +35,52 @@ jobs:
3435
run: npm ci
3536
- name: build
3637
run: |
37-
npm run prebuild --workspace=@jazzer.js/fuzzer -- ${{ matrix.opts }}
38-
npm run build --workspace=@jazzer.js/fuzzer -- ${{ matrix.opts }}
38+
npm run prebuild --workspace=@jazzer.js/fuzzer -- ${{ matrix.arch }}
39+
npm run build --workspace=@jazzer.js/fuzzer -- ${{ matrix.arch }}
3940
- name: upload
4041
uses: actions/upload-artifact@v7
4142
with:
42-
name: native-addon
43+
name: native-addon-${{ matrix.os }}${{ matrix.arch && '-x64' || '' }}
4344
path: packages/fuzzer/prebuilds
4445
if-no-files-found: error
4546

46-
release:
47-
name: release
47+
verify-prebuilds:
48+
name: verify prebuilds
4849
needs: [prebuilds]
4950
runs-on: ubuntu-latest
51+
permissions:
52+
contents: read
53+
steps:
54+
- name: download prebuilds
55+
uses: actions/download-artifact@v8
56+
with:
57+
pattern: native-addon-*
58+
path: prebuilds
59+
merge-multiple: true
60+
- name: verify all platforms are present
61+
run: |
62+
expected="fuzzer-darwin-arm64.node fuzzer-darwin-x64.node fuzzer-linux-arm64.node fuzzer-linux-x64.node fuzzer-win32-x64.node"
63+
for f in $expected; do
64+
if [ ! -f "prebuilds/$f" ]; then
65+
echo "MISSING: $f"
66+
exit 1
67+
fi
68+
done
69+
expected_count=$(echo $expected | wc -w)
70+
actual_count=$(ls prebuilds/ | wc -l)
71+
if [ "$actual_count" -ne "$expected_count" ]; then
72+
echo "Expected $expected_count prebuilds but found $actual_count:"
73+
ls -lh prebuilds/
74+
exit 1
75+
fi
76+
echo "Verified $expected_count prebuilds. All as expected:"
77+
ls -lh prebuilds/
78+
79+
publish:
80+
name: publish
81+
if: startsWith(github.ref, 'refs/tags/')
82+
needs: [verify-prebuilds]
83+
runs-on: ubuntu-latest
5084
permissions:
5185
contents: write # for creating releases
5286
steps:
@@ -65,9 +99,9 @@ jobs:
6599
- name: download prebuilds
66100
uses: actions/download-artifact@v8
67101
with:
68-
name: native-addon
102+
pattern: native-addon-*
69103
path: packages/fuzzer/prebuilds
70-
if-no-files-found: error
104+
merge-multiple: true
71105
- name: publish
72106
run: npm publish --workspaces --access public
73107
env:

0 commit comments

Comments
 (0)