name: Tests

on:
  push:
    branches: [main]
    paths:
      - "src/**"
      - "tests/**"
      - "pyproject.toml"
      - ".github/workflows/**"
  pull_request:
    paths:
      - "src/**"
      - "tests/**"
      - "pyproject.toml"
      - ".github/workflows/**"

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.12", "3.13", "3.14"]
    steps:
      - uses: actions/checkout@v6

      - uses: astral-sh/setup-uv@v7
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: uv sync --all-extras --group dev

      - name: Lint
        run: uvx ruff check src/ tests/

      - name: Format check
        run: uvx ruff format --check src/ tests/

      - name: Type check
        if: matrix.python-version == '3.13'
        run: uvx ty check src/

      - name: Tests
        run: uv run pytest --tb=short
