name: CI/CD
on: [push, pull_request]

jobs:
  test:
    name: Test with Node v${{ matrix.node }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [ 22, 24 ]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
      - run: npm ci
      - run: npm test
      - name: Publish coverage report
        if: github.ref == 'refs/heads/main' && matrix.node == 24
        uses: coverallsapp/github-action@v2
        with:
          file: coverage/lcov.info
          format: lcov
