name: CI

on:
  push:
    branches-ignore: [main]
  pull_request:
    branches: [main]

jobs:
  lint-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Lint
        run: npx eslint src/ --max-warnings 0

      - name: Test
        run: npx vitest run --coverage --reporter=verbose

      - name: Coverage Check
        run: |
          npx vitest run --coverage 2>&1 | tee coverage-output.txt
          echo "Coverage report generated"
