name: CI

on:
  push:
    branches:
      - main
  pull_request: {}

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

jobs:
  test:
    name: 'Test ${{ matrix.testenv.name }}'
    runs-on: ubuntu-latest
    timeout-minutes: 5
    strategy:
      matrix:
        testenv:
          - {name: 'Node', args: ''}
          - {name: 'Chrome', args: '--browser.name=chrome --browser.headless'}
          - {name: 'Firefox', args: '--browser.name=firefox --browser.headless'}

    steps:
      - uses: actions/checkout@v4
      - uses: wyvox/action-setup-pnpm@v3
      - run: pnpm install --no-lockfile
      - run: pnpm lint
      - run: pnpm build
      - run: pnpm vitest ${{ matrix.testenv.args }}
