name: Unit tests
permissions:
  contents: read

on: [push, pull_request]

jobs:
  unit_tests:

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

    steps:
      - uses: actions/checkout@v7
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v7
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
            python -m pip install --upgrade pip
            pip install -r requirements.txt
            pip install -r requirements_test.txt
      - name: Test with pytest
        run: pytest -v --cov-config=pyproject.toml --cov=cookidoo_api --cov-report=xml
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v7
        with:
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true