name: CI
on:
  push:
    branches:
      - main
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [22.x, 24.x] # NOTE: Keep in sync with README.
        # See Node.js release schedule: https://nodejs.org/en/about/previous-releases
        # - v22 EOL: Apr 30 2027
        # - v24 EOL: Apr 30 2028
    steps:
      - uses: actions/checkout@v7
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v7
        with:
          node-version: ${{ matrix.node-version }}
          cache: yarn
      - run: corepack enable
      - run: yarn install --frozen-lockfile
      - run: yarn build
      - run: yarn test
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 24.22.2
          cache: yarn
      - run: corepack enable
      - run: yarn install --frozen-lockfile
      - run: yarn prettier-check
      - run: yarn eslint
