Skip to content

Commit 3d2aded

Browse files
committed
ci: actually build arm64 binaries
1 parent ff76451 commit 3d2aded

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,48 @@ 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:
32-
- uses: actions/checkout@v4
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
3337
with:
3438
submodules: true
3539
fetch-depth: 0
36-
- uses: actions/setup-node@v4
40+
41+
- name: Setup Node
42+
uses: actions/setup-node@v4
3743
with:
3844
node-version: ${{ matrix.node }}
3945

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

45-
- uses: actions/upload-artifact@v4
69+
- name: Upload prebuilds
70+
uses: actions/upload-artifact@v4
4671
if: github.ref_type == 'tag' && matrix.node == 20
4772
with:
4873
path: prebuilds/**

package.json

Lines changed: 0 additions & 2 deletions
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)