This GitHub Action reports code coverage from LCOV files. This action includes:
- failing if a minimum coverage is not met
- commenting on a pull request
- commenting on the summary page
- generating an HTML report as an artifact
coverage-files
(required): Coverage files to scan (e.g.coverage/lcov.*.info
).artifact-name
(optional): Name of generated coverage report artifact. Default is no artifact created.minimum-line-coverage
(optional): Minimum % coverage to pass check. Default0
.minimum-branch-coverage
(optional): Minimum % coverage to pass check. Default0
.minimum-function-coverage
(optional): Minimum % coverage to pass check. Default0
.github-token
(optional): GitHub token to comment on PR.update-comment
(optional): Whether to update existing comment. Defaultfalse
.install-lcov
(optional): Whether lcov should be installed by this action. Defaulttrue
.comment-on-pr
(optional): Whether to create a comment in PR. Defaulttrue
.
total-line-coverage
: Total line coverage.total-branch-coverage
: Total branch coverage.total-function-coverage
: Total function coverage.merged-lcov-file
: Path to merged LCOV file.html-report-file
: Path to generated HTML report.html-report-dir
: Path to dir with HTML report.
jobs:
coverage_report:
name: Generate coverage report
needs: test-job
# Linux and macOS runners are supported
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# if running on Windows, please install `lcov` here
# tar may need to be installed on Windows as well
# tar is needed when generating an html report
- name: Report code coverage
uses: pavelsaman/github-actions-report-lcov@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage-files: coverage/lcov.*.info
minimum-line-coverage: 90
minimum-branch-coverage: 90
minimum-function-coverage: 90
update-comment: 'true'
The action works out of the box with Linux and macOS runners. If you want to use it on Windows runners, please install lcov
before running this action in a workflow.
Initial setup:
nvm use
make install
After source code changes, format, lint, and build the project with:
make build
Then push to remote. Then create a new tag or move the latest tag. You can use Create new version workflow for creating a new version.