Skip to content

feat: Replace custom coverage annotation script with GitHub action #4

feat: Replace custom coverage annotation script with GitHub action

feat: Replace custom coverage annotation script with GitHub action #4

Workflow file for this run

name: Pytest
on:
push:
branches:
- main
pull_request:
jobs:
run_pytest:
name: pytest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.12.7'
cache: 'poetry'
- run: poetry install --no-interaction --no-ansi
- name: Run Tests
run: |
poetry run pytest \
--cov \
--cov-report=xml \
--cov-report=term-missing \
${{ inputs.pytest_arguments }}
- name: Compare coverage (optional)
if: ${{ github.event_name == 'pull_request' }}
run: |
poetry run diff-cover coverage.xml \
--compare-branch=origin/main \
--json-report=diff_coverage.json \
--fail-under=80
- name: Annotate uncovered lines
if: ${{ always() && github.event_name == 'pull_request' }}
uses: drew2a/annotate-coverage-action@v0.2.0
with:
json_path: "diff_coverage.json"