This is a github action which is supposed to be run for a PR and visualizes the test coverage.
Everytime this action is run, we add a comment to the PR showing the current coverage.
If the trigger is not pull_request, this action does nothing. Also, if the length of the comment would exceed the GitHub limit, lines are trunctuated.
- Accepts code coverage as one or multiple
cobertura.xmlfiles - Visualizes coverage summary and per-file annotated snippets in the pull request
To run this action, create a workflow as follows:
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
# Generate coverage files
- name: Attach code-coverage comment
uses: rosslight/[email protected]
with:
files: |
coverage/coverage1.xml
coverage/coverage2.xml
update-comment: true
show-changed-lines-only: true
exclude-files: |
some_generated_files/*.rs| Name | Default | Description |
|---|---|---|
files |
(required) | One or multiple files. Can be multiple lines. Glob is supported |
update-comment |
true | TODO: Update |
show-changed-lines-only |
true | If part of a PR, filter coverage data against changed lines |
exclude-files |
'' | Glob patterns for files to exclude. Can be multiple lines. If empty, no files are excluded |
| Name | Description |
|---|---|
line-coverage |
The line coverage |
function-coverage |
The function coverage |
branch-coverage |
The branch coverage |
2/3 changed lines covered (Lines: 66.67%, Branches: 50%)
🔴 uncovered.ts — 2/3 changed lines covered (Lines: 66.67%, Branches: 50%)
1 🟨 if (true) {
2 🟩 return "true";
3 ⬛ else {
4 🟥 return "false";
5 ⬛ }Legend: 🟥 uncovered · 🟨 partial branch · 🟩 covered · ⬛ non-executable/blank
Generated by coverage-pr-comment
Releases are generated from conventional commits and aggregated using release-please.
When the release-please pull request is merged into main branch, a new release is created by GitHub Actions which includes the dist/ folder.