name: CI

on:
  push

jobs:
  build:
    runs-on: ubuntu-24.04
    timeout-minutes: 10

    strategy:
      matrix:
        python-version:
          - "3.12"

    steps:
    - name: Check out repository
      uses: actions/checkout@v4

    - name: Install uv
      uses: astral-sh/setup-uv@v3
      with:
        version: "0.7.4"
        enable-cache: true
        cache-dependency-glob: "uv.lock"

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

    - name: Create virtal environment
      run: |-
          make install-ci-env

    - name: Run tests
      run: |-
          source .venv/bin/activate
          coverage run -m pytest -v tests/
          coverage report --omit="tests/*"
          coverage xml --omit="tests/*"

    - name: Upload coverage reports to Codecov
      uses: codecov/codecov-action@v4
      with:
          files: ./coverage.xml
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
