From b0eb29c2d8d0dc1493ee4bf2895dbde81487e447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 10 Jun 2026 15:55:33 +0200 Subject: [PATCH] Add Codecov coverage reporting - Run pytest with --cov to generate coverage.xml - Upload coverage to Codecov via OIDC (no token required) - Use unit-tests flag for coverage categorization - Add codecov.yml with thresholds and flag configuration --- .github/workflows/ci.yml | 18 ++++++++++++++++-- codecov.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8e91af..a336019 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,13 @@ jobs: container: image: fedora:latest + permissions: + id-token: write # Required for Codecov OIDC authentication + steps: + - name: Install git-core + run: dnf install -y git-core + - uses: actions/checkout@v6 - name: Install uv and setup Python version @@ -49,10 +55,18 @@ jobs: enable-cache: true - name: Install dependencies - run: uv sync --group test --no-dev + run: uv sync --group test --group coverage --no-dev - name: Run tests - run: uv run pytest tests + run: uv run pytest tests --cov=productmd --cov-report=xml:coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + use_oidc: true + flags: unit-tests + files: coverage.xml + fail_ci_if_error: false test-py36: needs: [lint, format, bandit] diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..c1b6999 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,29 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "50...100" + + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: auto + threshold: 1% + +flags: + unit-tests: + carryforward: true + +comment: + layout: "reach,diff,flags,files" + behavior: default + +ignore: + - "doc/**" + - "tests/**"