Skip to content

feat: STRF-13629 Support node 22 #147

feat: STRF-13629 Support node 22

feat: STRF-13629 Support node 22 #147

name: Tests
on:
pull_request:
branches: [master, main]
push:
branches: [master, main]
jobs:
build:
strategy:
matrix:
node: [20.x, 22.x, 24.x]
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Set up Python
if: startsWith(matrix.os, 'windows')
id: py
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Force npm to use this Python
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
# setup-python exposes $env:PythonLocation
echo "npm_config_python=$env:PythonLocation\python.exe" | Out-File -FilePath $env:GITHUB_ENV -Append
npm config set python "$env:PythonLocation\python.exe"
python --version
npm config get python
- name: Pin node-gyp 10 on Windows
if: startsWith(matrix.os, 'windows')
run: |
npm i -g node-gyp@10
# Tell npm/node-pre-gyp consumers to use this node-gyp
setx npm_config_node_gyp "%APPDATA%\npm\node_modules\node-gyp\bin\node-gyp.js"
- name: Force VS toolchain discovery (skip PowerShell)
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
# Adjust this path if your runner uses Community or BuildTools
$vsPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
echo "GYP_MSVS_VERSION=2022" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "GYP_MSVS_OVERRIDE_PATH=$vsPath" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "npm_config_msvs_version=2022" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "npm_config_python=$((Get-Command python).Path)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install Dependencies
run: npm ci
- name: Lint the code
run: npm run lint
- name: Run tests
run: npm run test