# A CI workflow in the .yml spelling, in the style GitHub Actions uses.
# Free sample from 99helpers.com/file-types/yaml
# Note the key "on": a YAML 1.1 loader reads it as the boolean true.

name: Test and build

on:
  push:
    branches: [main]
  pull_request:

env:
  NODE_VERSION: "22"

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: ["20", "22"]
    steps:
      - name: Check out the code
        uses: actions/checkout@v4
      - name: Set up Node.js ${{ matrix.node }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - name: Install and test
        run: |
          npm ci
          npm test
