Works on every version
Your users run Node 18, 20 and 22. A matrix runs the same job once per combination — in parallel on GitHub — so you know it works everywhere.
strategy.matrix
name: Matrix
on: push
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [18, 20, 22]
include:
- node: 22
experimental: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm test
- if: matrix.experimental
run: echo "Extra checks on the newest Node"