name: Coverage

on:
  pull_request:
    branches:
      - "*"
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0 # required for setuptools-scm

      - name: Install uv and set the python version
        uses: astral-sh/setup-uv@v7
        with:
          python-version: "3.11"
          activate-environment: "true"
          github-token: ${{ github.token }}

      - name: Install the project
        run: uv sync --dev
        shell: bash

      - name: Run coverage
        run: uv run pytest tests --cov=py_ballisticcalc --cov-report=html
        shell: bash
#    - name: Install "coverage-badge"
#      run: uv pip install coverage-badge
#
#    - name: Generate coverage badge
#      run: coverage-badge -o coverage.svg
#
#    - name: Upload coverage badge
#      uses: actions/upload-artifact@v4
#      with:
#        name: coverage.svg
#        path: coverage.svg
