55
66jobs :
77 build-test :
8- name : Build & Test (${{ matrix.os }})
8+ name : Build & Test (${{ matrix.os }}${{ matrix.cross && ' xarch' || '' }} )
99 runs-on : ${{ matrix.os }}
1010 strategy :
1111 fail-fast : false
1212 matrix :
1313 os : [ubuntu-22.04, macos-14, windows-2022]
14+ cross : [false, true]
1415 steps :
1516 - name : Checkout
1617 uses : actions/checkout@v4
@@ -22,19 +23,32 @@ jobs:
2223 with :
2324 node-version : ' 22.x'
2425
26+ - name : Set architecture
27+ id : arch
28+ shell : bash
29+ run : |
30+ if [ "${{ runner.os }}" = "macOS" ]; then
31+ echo "arch=${{ matrix.cross && 'x64' || 'arm64' }}" >> $GITHUB_OUTPUT
32+ else
33+ echo "arch=${{ matrix.cross && 'arm64' || 'x64' }}" >> $GITHUB_OUTPUT
34+ fi
35+
2536 - name : Install sysroot
2637 if : runner.os == 'Linux'
2738 run : |
2839 sudo apt-get update -qq
2940 sudo apt-get install -y gcc-10 g++-10
30- SYSROOT_PATH=$(node scripts/linux/install-sysroot.js x64 | grep "SYSROOT_PATH=" | cut -d= -f2)
41+ SYSROOT_PATH=$(node scripts/linux/install-sysroot.js ${{ steps.arch.outputs.arch }} | grep "SYSROOT_PATH=" | cut -d= -f2)
3142 echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV
3243 echo "Sysroot path set to: $SYSROOT_PATH"
3344 echo "CC=gcc-10" >> $GITHUB_ENV
3445 echo "CXX=g++-10" >> $GITHUB_ENV
3546
3647 - name : Install dependencies and build
3748 run : npm ci
49+ env :
50+ ARCH : ${{ steps.arch.outputs.arch }}
51+ npm_config_arch : ${{ steps.arch.outputs.arch }}
3852
3953 - name : Verify GLIBC requirements
4054 if : runner.os == 'Linux'
4559 ./scripts/linux/verify-glibc-requirements.sh
4660
4761 - name : Test
62+ if : ${{ !matrix.cross }}
4863 run : npm test
4964
5065 - name : Lint
66+ if : ${{ !matrix.cross }}
5167 run : npm run lint
0 commit comments