Skip to content

Commit 2e5cf29

Browse files
committed
ci: actually build arm64 binaries
1 parent ff76451 commit 2e5cf29

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

.github/workflows/ci.yml

+26-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ jobs:
2626
- 20
2727
- 22
2828
fail-fast: false
29-
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
29+
name: Test Node ${{ matrix.node }} on ${{ matrix.os }}
3030
runs-on: ${{ matrix.os }}
31+
defaults:
32+
run:
33+
shell: bash
3134
steps:
3235
- uses: actions/checkout@v4
3336
with:
@@ -37,10 +40,28 @@ jobs:
3740
with:
3841
node-version: ${{ matrix.node }}
3942

40-
- run: npm install
41-
- run: npm run build_x64
42-
- run: npm run build_arm64
43-
- run: npm test
43+
- name: Install dependencies
44+
run: npm ci --legacy-peer-deps
45+
46+
- name: Set npm_config_target
47+
run: echo "CONFIG_TARGET=${{ matrix.node == 22 && '22.12.0' || '20.9.0' }}" >> $GITHUB_ENV
48+
49+
- name: Build x64 binary
50+
run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch x64 -t 20.9.0
51+
52+
- name: Set up cross-compilation
53+
if: runner.os == 'Linux'
54+
run: |-
55+
sudo apt-get update
56+
sudo apt-get install g++-aarch64-linux-gnu
57+
printf '%s\n' >> "$GITHUB_ENV" \
58+
'CC=aarch64-linux-gnu-gcc' 'CXX=aarch64-linux-gnu-g++'
59+
60+
- name: Build arm64 binary
61+
run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch arm64 -t 20.9.0
62+
63+
- name: Run tests
64+
run: npm test
4465

4566
- uses: actions/upload-artifact@v4
4667
if: github.ref_type == 'tag' && matrix.node == 20

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
"docs": "typedoc --out docs/api tree-sitter.d.ts --readme README.md",
5757
"install": "node-gyp-build",
5858
"build": "prebuildify --napi --strip",
59-
"build_x64": "prebuildify --napi --strip --arch x64 --target 20.9.0",
60-
"build_arm64": "prebuildify --napi --strip --arch arm64 --target 20.9.0",
6159
"rebuild": "node-gyp rebuild",
6260
"test": "node -e \"require('child_process').spawnSync('node', ['--test', ...require('glob').sync('test/**/*.js')], {stdio:'inherit'})\""
6361
},

0 commit comments

Comments
 (0)