Skip to content

saschanowak/CloverCodeCoverageSummary

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Code Coverage Summary

A GitHub Action that reads Clover format code coverage files from your test suite and outputs a markdown summary. This summary can be posted as a Pull Request comment or included in Release Notes by other actions to give you an immediate insight into the health of your code without using a third-party site. Code Coverage Summary is designed for use with any test framework that outputs coverage in Clover XML format. The action has a build in feature to group coverage by package. This currently works with composer.json only.

Inputs

filename

Required

A path to the code coverage file to analyse. Also supports using glob patterns to match multiple files. If there are any spaces in a path or filename this value must be in quotes.

Outputs

Markdown Example Summary

Code Coverage
Package Lines Functions Classes Health
nxdummy 96% 26/27 83% 5/6 93% 31/33
Summary 96% 26/27 83% 5/6 93% 31/33

Markdown Example Details

Code Coverage details
Code Coverage
Class Lines Functions Classes Health
nxdummy
Netlogix\Nxdummy\Exception\OptionNotFoundException NaN% 0/0 NaN% 0/0 NaN% 0/0
Netlogix\Nxdummy\Options\MiddlewareOptions 90% 10/11 66% 2/3 85% 12/14
Netlogix\Nxdummy\Utility\UriUtility 100% 16/16 100% 3/3 100% 19/19 🚀
Summary 96% 26/27 83% 5/6 93% 31/33

Usage

name: Code Coverage Summary Report
uses: saschanowak/CloverCodeCoverageSummary@v1.0.0
with:
  filename: clover.xml

Add the following to your workflow to include the summary in the job summary:

name: 'Add Code Coverage to Job Summary'
run: |
  cat code-coverage-summary.md >> $GITHUB_STEP_SUMMARY
  cat code-coverage-details.md >> $GITHUB_STEP_SUMMARY

Add the following to your workflow to post the summary as a Pull Request comment:

name: 'Add Code Coverage Summary as PR Comment'
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
  recreate: true
  path: code-coverage-summary.md

Version Numbers

Version numbers will be assigned according to the Semantic Versioning scheme. This means, given a version number MAJOR.MINOR.PATCH, we will increment the:

  1. MAJOR version when we make incompatible API changes
  2. MINOR version when we add functionality in a backwards compatible manner
  3. PATCH version when we make backwards compatible bug fixes

Contributing

Report Bugs

Please make sure the bug is not already reported by searching existing issues.

If you're unable to find an existing issue addressing the problem please open a new one. Be sure to include a title and clear description, as much relevant information as possible, a workflow sample and any logs demonstrating the problem.

Suggest an Enhancement

Please open a new issue.

Submit a Pull Request

Discuss your idea first, so that your changes have a good chance of being merged in.

Submit your pull request against the main branch.

Pull requests that include documentation and relevant updates to README.md are merged faster, because you won't have to wait for somebody else to complete your contribution.

License

Code Coverage Summary is available under the MIT license, see the LICENSE file for more info.

About

A GitHub Action that reads Clover format code coverage files from your test suite and outputs a markdown summary

Resources

License

Stars

Watchers

Forks

Packages

No packages published