Skip to content

Commit b32e386

Browse files
authored
SEP-996: Show coverage evolution in PR coverage report comments (#546)
- Adds `.github/workflows/coverage-main.yml` that runs the test suite on pushes to `main` and invokes `py-cov-action/python-coverage-comment-action`, so main-branch coverage JSON gets committed to the `python-coverage-comment-action-data` branch. Permissions follow least-privilege: the workflow defaults to `contents: read` and only the `store-coverage` job elevates to `contents: write`. - Subsequent PR coverage comments will render the evolution badge (e.g. `83% → 84%`) instead of `"Previous coverage rate is not available, cannot report on evolution"`. - Reuses the existing `setup-python-job` composite action and the same action SHA (v3.40) already pinned in `python.yaml`. The existing PR-side two-workflow pattern is untouched.
1 parent 4071b02 commit b32e386

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Store main-branch coverage data so PR coverage comments can display
2+
# evolution (old% -> new%). The py-cov-action commits coverage JSON to
3+
# the python-coverage-comment-action-data branch on pushes to main, and
4+
# subsequent PR runs read from it to compute the delta.
5+
6+
name: Coverage (main)
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
store-coverage:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout codebase
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
25+
- name: Setup Python
26+
uses: ./.github/actions/setup-python-job
27+
with:
28+
python-version: "3.11.9"
29+
cache: poetry
30+
31+
- name: Install test dependencies
32+
run: poetry install --with syncmysql
33+
34+
- name: Run tests
35+
run: make test
36+
37+
- name: Store coverage data on data branch
38+
uses: py-cov-action/python-coverage-comment-action@7188638f871f721a365d644f505d1ff3df20d683 # v3.40
39+
with:
40+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)