@@ -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/**
0 commit comments