| name: Node.js CI Unix Platform | |
| on: [push, pull_request] | |
| env: | |
| PYTHON_VERSION: '3.11' | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| api_version: | |
| - standard | |
| - experimental | |
| node-version: | |
| - 22.x | |
| - 24.x | |
| - 26.x | |
| os: | |
| - macos-latest | |
| - ubuntu-latest | |
| compiler: | |
| - clang | |
| - gcc | |
| exclude: | |
| - os: macos-latest | |
| compiler: gcc # GCC is an alias for clang on the MacOS image. | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Check Node.js installation | |
| run: | | |
| node --version | |
| npm --version | |
| - name: Install dependencies | |
| run: | | |
| npm install | |
| # Node.js >= 26 requires node-gyp@13; older versions keep node-gyp@12 | |
| # (from package.json). | |
| - name: Use node-gyp@13 for Node.js >= 26 | |
| if: matrix.node-version == '26.x' | |
| run: npm install --no-save node-gyp@13 | |
| - name: npm test | |
| run: | | |
| if [ "${{ matrix.api_version }}" = "experimental" ]; then | |
| export NAPI_VERSION=2147483647 | |
| fi | |
| if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
| export CC="gcc" CXX="g++" | |
| fi | |
| if [ "${{ matrix.compiler }}" = "clang" ]; then | |
| export CC="clang" CXX="clang++" | |
| fi | |
| echo "CC=\"$CC\" CXX=\"$CXX\"" | |
| echo "$CC --version" | |
| $CC --version | |
| echo "$CXX --version" | |
| $CXX --version | |
| export CFLAGS="$CFLAGS -O3 --coverage" LDFLAGS="$LDFLAGS --coverage" | |
| echo "CFLAGS=\"$CFLAGS\" LDFLAGS=\"$LDFLAGS\"" | |
| npm run pretest -- --verbose | |
| node test |