name: CI

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

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        python-version: ["3.12", "3.13"]

    steps:
    - uses: actions/checkout@v4

    - name: Install uv
      uses: astral-sh/setup-uv@v4
      with:
        version: "latest"

    - name: Set up Python ${{ matrix.python-version }}
      run: uv python install ${{ matrix.python-version }}

    - name: Install dependencies
      run: |
        uv sync --dev

    - name: Run ruff check
      run: uv run ruff check .

    - name: Run ruff format check
      run: uv run ruff format --check .

    - name: Run mypy
      run: uv run mypy .

    - name: Run tests
      run: uv run pytest

    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v5
      if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
      with:
        file: ./coverage.xml
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: false
