name: CI

on:
  push:
    branches: [main, master]
  pull_request:

permissions:
  contents: read

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

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 25
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Build and unit tests
        run: npm run check

      - name: Validate schema fixtures
        run: npm run schemas:validate

      - name: API contract tests
        run: npm run test:contract

      - name: Install Playwright browsers
        run: npx playwright install --with-deps chromium

      - name: Playwright E2E
        run: npm run test:e2e
