name: Test

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

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        django-version: ["4.2", "5.1", "5.2"]
        python-version: ["3.10", "3.11", "3.12", "3.13"]
    steps:
      - uses: actions/checkout@v4

      - name: Install uv and set the python version
        uses: astral-sh/setup-uv@v5
        with:
          enable-cache: true
          python-version: ${{ matrix.python-version }}

      - name: Install the project
        run: uv sync --all-extras --dev

      - name: Install django ${{ matrix.django-version }}
        run: uv add "django==${{ matrix.django-version }}"

      - name: Run tests and collect coverage
        run: uv run pytest -vv --cov=expo_notifications --cov-report=xml

      - name: Upload coverage reports to Codecov with GitHub Action
        uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
