Skip to content

Commit 380dc91

Browse files
Copilotpancetta
andauthored
Fix Codecov integration and improve coverage reporting (#602)
* Initial plan * Update Codecov integration to v5 and add codecov.yml config Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> * Improve code coverage documentation with multiple viewing options Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pancetta <7158893+pancetta@users.noreply.github.com>
1 parent 5bfc164 commit 380dc91

3 files changed

Lines changed: 70 additions & 3 deletions

File tree

.github/workflows/postprocess.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ jobs:
3939
run: |
4040
genbadge coverage -i coverage.xml -o htmlcov/coverage-badge.svg
4141
- name: Upload coverage reports to Codecov
42-
uses: codecov/codecov-action@v4
42+
uses: codecov/codecov-action@v5
4343
with:
44-
token: ${{ secrets.CODECOV }}
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
files: ./coverage.xml
46+
fail_ci_if_error: false
47+
verbose: true
4548

4649
# - name: Generate benchmark report
4750
# uses: pancetta/github-action-benchmark@v1

codecov.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
notify:
4+
wait_for_ci: yes
5+
6+
coverage:
7+
precision: 2
8+
round: down
9+
range: "70...100"
10+
status:
11+
project:
12+
default:
13+
target: auto
14+
threshold: 1%
15+
base: auto
16+
patch:
17+
default:
18+
target: auto
19+
threshold: 1%
20+
base: auto
21+
22+
comment:
23+
layout: "reach,diff,flags,tree,reach"
24+
behavior: default
25+
require_changes: false
26+
require_base: false
27+
require_head: true
28+
29+
ignore:
30+
- "pySDC/tests/**"
31+
- "pySDC/playgrounds/**"
32+
- "pySDC/projects/deprecated/**"
33+
- "data/**"
34+
- "docs/**"
35+
- "etc/**"
36+
- "setup.py"

docs/contrib/02_continuous_integration.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,30 @@ This stage allows to checks how much of the `pySDC` code is tested by the previo
162162
- `pySDC/tutorial`
163163
164164
This analysis is done in parallel to the test each time a pull is done on any branch (main repository or fork).
165-
You can look at the current [coverage report for the master branch](https://parallel-in-time.org/pySDC/coverage/index.html) or [compare the results with previous builds](https://app.codecov.io/gh/Parallel-in-Time/pySDC). Codecov will also comment on any pull request, indicating the change of coverage.
165+
166+
### Viewing Coverage Reports
167+
168+
There are multiple ways to view test coverage for pySDC:
169+
170+
1. **HTML Coverage Report** (recommended for detailed analysis)
171+
- View the current [coverage report for the master branch](https://parallel-in-time.org/pySDC/coverage/index.html)
172+
- Shows line-by-line coverage with color coding
173+
- Updated automatically with each push to master
174+
175+
2. **Codecov Dashboard** (for trends and PR analysis)
176+
- [Compare results with previous builds](https://app.codecov.io/gh/Parallel-in-Time/pySDC)
177+
- View coverage trends over time
178+
- See coverage impact of specific commits
179+
- Codecov automatically comments on pull requests with coverage changes
180+
181+
3. **Coverage Badge** (quick status check)
182+
- Displayed in the [README](../../README.md)
183+
- Shows current coverage percentage for master branch
184+
185+
4. **PR Coverage Comments** (for contributors)
186+
- Codecov comments on each pull request
187+
- Shows coverage changes introduced by the PR
188+
- Highlights uncovered lines in modified files
166189
167190
During developments, you can also run the coverage tests locally, using :
168191
@@ -186,6 +209,11 @@ This will generate the coverage report in a `htmlcov` folder, and you can open t
186209
187210
### Coverage exceptions
188211
212+
The coverage configuration is defined in two places:
213+
214+
1. **Runtime configuration** (`pyproject.toml`) - Controls what coverage measures during test execution
215+
2. **Codecov configuration** (`codecov.yml`) - Controls how Codecov reports and displays coverage
216+
189217
Some types of code lines will be ignored by the coverage analysis (_e.g_ lines starting with `raise`, ...), see the `[tool.coverage.report]` section in `pyproject.toml`.
190218
Part of code (functions, conditionaly, for loops, etc ...) can be ignored by coverage analysis using the `# pragma: no cover`, for instance
191219

0 commit comments

Comments
 (0)