name: CI

on:
  pull_request:
    branches: [main]

jobs:
  test:
    name: Tests
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: astral-sh/setup-uv@v7

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Install Stockfish
        run: sudo apt-get update && sudo apt-get install -y stockfish

      - name: Install dependencies
        run: uv sync --group test

      - name: Run unit tests
        run: uv run pytest tests/ --ignore=tests/e2e -v

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

      - name: Run e2e tests
        run: uv run pytest tests/e2e/ -v
