name: Tests

on:
    pull_request:
    push:
        branches: [master, develop]

concurrency:
    group: tests-${{ github.workflow }}-${{ github.head_ref || github.ref }}
    cancel-in-progress: true

jobs:
    test:
        name: Node ${{ matrix.node }}
        runs-on: ubuntu-latest
        strategy:
            fail-fast: false
            matrix:
                # 18 is the floor declared in package.json engines
                node: [18, 20, 22]

        steps:
            - uses: actions/checkout@v7

            - uses: pnpm/action-setup@v6
              with:
                  version: 10.7.1

            - uses: actions/setup-node@v7
              with:
                  node-version: ${{ matrix.node }}
                  cache: pnpm

            - run: pnpm install --frozen-lockfile

            - run: pnpm test
