# Generate code coverage

name: codecov

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  run:
    name: Generate coverage report for Python ${{ matrix.python-version }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, ubuntu-latest, macos-latest]
        python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: Generate coverage reports
        run: bash .github/actions/codecov/generate_coverage.sh

      - name: Upload coverage reports
        uses: codecov/codecov-action@v5
        if: ${{ github.event_name != 'pull_request' }}
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
          verbose: true
