Skip to content

Upload test coverage to GitHub Code Quality - #920

Draft
Sun Haoran (haoranpb) wants to merge 2 commits into
core/stack-03-loggingfrom
core/stack-04-code-coverage
Draft

Sun Haoran (haoranpb) wants to merge 2 commits into
core/stack-03-loggingfrom
core/stack-04-code-coverage

Conversation

@haoranpb

Copy link
Copy Markdown
Collaborator

Stack 4, stacked on #918. Code Quality is enabled for the repository; this uploads the pytest coverage report so github-code-quality[bot] reports PR coverage against main (manual setup docs).

  • Report: uv run pytest --cov --cov-report=term-missing --cov-report=xml writes a Cobertura coverage.xml (already gitignored).
  • Repo-relative paths: with two --cov source folders, coverage records paths relative to each folder, so logger.py or __init__.py cannot be mapped back unambiguously. [tool.coverage.run] now uses relative_files = true with an include allow-list, so every entry is a repo path such as src/bcbench/logger.py. Trade-off: only imported modules are reported; in the full suite that excludes src/bcbench/__main__.py alone.
  • Upload: actions/upload-code-coverage (pinned to v1.4.4) runs on the Ubuntu matrix leg only, keeping one report per label, and skips fork PRs, which cannot get code-quality: write. The job gains code-quality: write.
  • Checkout: lint-and-test checks out the PR head instead of the merge commit, as the docs require for line mapping. Both lint and tests now run on the PR head; the other jobs are unchanged.

The baseline appears after the first push to main; coverage comments appear on PRs that target main.

Sun Haoran (haoranpb) and others added 2 commits October 2, 2026 15:17
Code Quality is enabled for the repository, so CI uploads the pytest
coverage report and github-code-quality[bot] comments on pull requests.

- Coverage paths are repo-relative (relative_files + include), so files
  with the same name in bcbench and bcbench_core map unambiguously
- CI checks out the PR head instead of the merge commit, as the upload
  requires, and only the Ubuntu run uploads to keep one report per label

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3fa47b3c-f5d6-4c36-9be3-c4fdf2bebe47
The coverage API rejects uploads from non-default branches without a pull
request number, so manually dispatched runs on feature branches skip it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3fa47b3c-f5d6-4c36-9be3-c4fdf2bebe47

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant