name: CI

on: [push, pull_request]

env:
  NODE_VERSION: 22.x

jobs:
  code-quality:
    name: Code quality checks
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v6

      - name: Install pnpm
        uses: pnpm/action-setup@v4
        with:
          run_install: false

      - uses: actions/setup-node@v6
        with:
          node-version: ${{ env.NODE_VERSION }}
          cache: pnpm

      - name: Install dependencies
        run: pnpm install --frozen-lockfile

      - name: Run ESLint
        run: pnpm run lint:check

      - name: Type check
        run: pnpm run type:check

      - name: Run tests
        run: pnpm run test:unit
