Skip to content

Commit bcd10ce

Browse files
authored
Fixes error on stale coverage cache (#1713)
1 parent 727447b commit bcd10ce

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/github-nightly-uv.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,13 @@ jobs:
355355
- name: Merge coverage reports
356356
run: |
357357
uv run --no-sync coverage combine
358-
uv run --no-sync coverage report --show-missing --omit="*test*" --omit="*internal*" --omit="*experimental*" --fail-under=45
359-
uv run --no-sync coverage html
358+
# -i / --ignore-errors downgrades coverage's fatal "No source for
359+
# code" error to a warning, matching the PR workflow. Kept in
360+
# lockstep with github-pr.yml per .github/CACHE_CONTRACT.md.
361+
uv run --no-sync coverage report -i --show-missing --omit="*test*" --omit="*internal*" --omit="*experimental*" --fail-under=45
362+
uv run --no-sync coverage html -i
360363
# Also create an XML report for potential CI integrations
361-
uv run --no-sync coverage xml -o coverage.xml
364+
uv run --no-sync coverage xml -i -o coverage.xml
362365
363366
- name: Upload coverage HTML report
364367
uses: actions/upload-artifact@v4

.github/workflows/github-pr.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,13 @@ jobs:
227227
228228
uv run --no-sync coverage combine
229229
230-
uv run --no-sync coverage report --show-missing --omit="*test*" --omit="*internal*" --omit="*experimental*" --fail-under=45
231-
uv run --no-sync coverage html
232-
uv run --no-sync coverage xml -o coverage.xml
230+
# -i / --ignore-errors downgrades coverage's fatal "No source for
231+
# code" error to a warning. The restored nightly baseline can
232+
# reference files this PR has moved or deleted (e.g. a renamed
233+
# module); without -i the combined report aborts on the stale path.
234+
uv run --no-sync coverage report -i --show-missing --omit="*test*" --omit="*internal*" --omit="*experimental*" --fail-under=45
235+
uv run --no-sync coverage html -i
236+
uv run --no-sync coverage xml -i -o coverage.xml
233237
234238
- name: Upload coverage HTML report
235239
uses: actions/upload-artifact@v4

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ pytest-internal:
4444

4545
coverage:
4646
coverage combine && \
47-
coverage report --show-missing --omit=*test* --omit=*internal* --omit=*experimental* --fail-under=60 && \
48-
coverage html
47+
coverage report -i --show-missing --omit=*test* --omit=*internal* --omit=*experimental* --fail-under=60 && \
48+
coverage html -i
4949

5050
all-ci: get-data setup-ci black interrogate lint license install pytest doctest coverage
5151

test/get_coverage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ coverage run \
1111
--doctest-modules ../physicsnemo/
1212

1313
coverage combine --data-file=.coverage
14-
coverage report --omit=*test*
14+
coverage report -i --omit=*test*
1515

1616
# if you wish to view the report in HTML format uncomment below
17-
# coverage html --omit=*test*
17+
# coverage html -i --omit=*test*
1818

1919
# cleanup
2020
rm .coverage

0 commit comments

Comments
 (0)