Code Coverage Assistant
GitHub Action to assist the pull request with code coverage stats
- ✅ Code coverage comment for monorepo
- ✅ Code coverage comment for single repo
- ✅ Code coverage diff from base branch
The report is based on the lcov coverage report generated by your test runner.
Usage
Just add this action to one of your workflow files:
- name: Add coverage comment
uses: ScaCap/code-coverage-assistant@v1
Action inputs
The possible inputs for this action are:
Parameter | Description | Default |
---|---|---|
github-token (Required) |
Github token used for posting the comment. To use the key provided by the GitHub action runner, use ${{ secrets.GITHUB_TOKEN }} . |
|
monorepo-base-path (Optional) |
The location of your monrepo packages path |
|
lcov-file (Optional) |
The location of the lcov file to read the coverage report. Needed only for single repos |
./coverage/lcov.info |
lcov-base (Optional) |
The location of the lcov file resulting from running the tests in the base branch. When this is set a diff of the coverage percentages is shown. Needed only for single repos . |
Examples
Code coverage comment for monorepo
uses: ScaCap/code-coverage-assistant@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
monorepo-base-path: "./packages"
Code coverage comment for single repo
uses: ScaCap/code-coverage-assistant@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: "./app/coverage/lcov.info"
Code coverage comment with diff
lcov-base.info
coverage file for base branch in your .coverage
dir
uses: ScaCap/code-coverage-assistant@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
monorepo-base-path: "./packages"
Development
Contributing
Contributions are encouraged! Fork this repo and open a pull request.
Commands
command | description |
---|---|
test |
Run the unit tests |
eslint |
Run eslint on all applicable files |
format |
Run prettier on all applicable files |
build |
build the dist file. You are required to run this locally in order to build the dist before opening a PR. |
Releasing
This action follows semantic versioning.
Creating a release
- Ensure master is up to date with all the changes for the next release
- In the GitHub releases page, click "draft a new release"
- Choose a tag matching this pattern:
vX.X.X
- Choose
master
as the target - Use the exact tag as the release title
- Write a description containing all the changes since the last release, and detailing any breaking changes
- Choose "Publish Release"
- Choose a tag matching this pattern:
- Github will create the release and add the appropriate tag
Acknowledgements
The initial code is based on romeovs/lcov-reporter-action.
Thanks to: