Skip to content

Commit

Permalink
ci: actually build arm64 binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Dec 30, 2024
1 parent ff76451 commit 830d9f4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- 20
- 22
fail-fast: false
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
name: Test Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -37,10 +37,28 @@ jobs:
with:
node-version: ${{ matrix.node }}

- run: npm install
- run: npm run build_x64
- run: npm run build_arm64
- run: npm test
- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Set npm_config_target
run: echo "CONFIG_TARGET=${{ matrix.node == 22 && '22.12.0' || '' }}" >> $GITHUB_ENV

- name: Build x64 binary
run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch x64 -t 20.9.0

- name: Set up cross-compilation
if: runner.os == 'Linux'
run: |-
sudo apt-get update
sudo apt-get install g++-aarch64-linux-gnu
printf '%s\n' >> "$GITHUB_ENV" \
'CC=aarch64-linux-gnu-gcc' 'CXX=aarch64-linux-gnu-g++'
- name: Build arm64 binary
run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch arm64 -t 20.9.0

- name: Run tests
run: npm test

- uses: actions/upload-artifact@v4
if: github.ref_type == 'tag' && matrix.node == 20
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
"docs": "typedoc --out docs/api tree-sitter.d.ts --readme README.md",
"install": "node-gyp-build",
"build": "prebuildify --napi --strip",
"build_x64": "prebuildify --napi --strip --arch x64 --target 20.9.0",
"build_arm64": "prebuildify --napi --strip --arch arm64 --target 20.9.0",
"rebuild": "node-gyp rebuild",
"test": "node -e \"require('child_process').spawnSync('node', ['--test', ...require('glob').sync('test/**/*.js')], {stdio:'inherit'})\""
},
Expand Down

0 comments on commit 830d9f4

Please sign in to comment.