mirror of
https://github.com/irongut/CodeCoverageSummary.git
synced 2026-05-14 14:10:14 +02:00
updated readme
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
# Code Coverage Summary Action
|
||||
# Code Coverage Summary
|
||||
|
||||
WORK IN PROGRESS
|
||||
A GitHub Action that reads Cobertura format code coverage files and outputs a text or markdown summary. Other Actions can then post the summary as a pull request comment, include it in release notes, etc.
|
||||
|
||||
A GitHub Action to analyse test code coverage in Cobertura format and output a summary.
|
||||
|
||||
Written for use with [Coverlet](https://github.com/coverlet-coverage/coverlet) on .Net but it should work with any tests that output coverage in Cobertura format.
|
||||
Written for use with [Coverlet](https://github.com/coverlet-coverage/coverlet) and .Net but it should work with any tests that output coverage in Cobertura format.
|
||||
|
||||
## Inputs
|
||||
|
||||
@@ -13,13 +11,13 @@ Written for use with [Coverlet](https://github.com/coverlet-coverage/coverlet) o
|
||||
|
||||
Code coverage file to analyse.
|
||||
|
||||
Note: Coverlet creates the coverage file in a random named directory (guid) so you need to copy it to a predictable path before running this Action, see [.Net 5 Workflow Example](#net-5-workflow-example) below.
|
||||
Note: Coverlet creates the coverage file in a random named directory (guid) so you need to copy it to a predictable path before running this Action, see the [.Net 5 Workflow Example](#net-5-workflow-example) below.
|
||||
|
||||
#### `badge`
|
||||
|
||||
Include a badge in the output using [shields.io](https://shields.io/) - `true` or `false` (default).
|
||||
Include a badge reporting the Line Rate coverage in the output using [shields.io](https://shields.io/) - `true` or `false` (default).
|
||||
|
||||
If code coverage is less than 50% the badge will be red, if coverage is 50% - 74% it will be yellow and if coverage is 75% or over it will be green.
|
||||
If the overall Line Rate is less than 50% the badge will be red, if it is 50% - 74% it will be yellow and if it is 75% or over it will be green.
|
||||
|
||||
#### `format`
|
||||
|
||||
@@ -31,14 +29,14 @@ Output Type - `console` (default), `file` or `both`.
|
||||
|
||||
`console` will output the coverage summary to the GitHub Action log.
|
||||
|
||||
`file` will output the coverage summary to `code-coverage-results.txt` or `code-coverage-results.md` in the workflow's working directory.
|
||||
`file` will output the coverage summary to `code-coverage-results.txt` for text or `code-coverage-results.md` for markdown format in the workflow's working directory.
|
||||
|
||||
`both` will output the coverage summary to the Action log and a file as above.
|
||||
|
||||
## Outputs
|
||||
|
||||
Code coverage summary in plain text or markdown format to the console (action log) or a file.
|
||||
|
||||
#### Text Example
|
||||
```
|
||||
Code Coverage File: coverage/coverage.cobertura.xml
|
||||
https://img.shields.io/badge/Code%20Coverage-77%25-success?style=flat
|
||||
Line Rate = 77%, Lines Covered = 1107 / 1433
|
||||
Branch Rate = 60%, Branches Covered = 321 / 532
|
||||
@@ -47,11 +45,14 @@ Company.Example: Line Rate = 78%, Branch Rate = 60%, Complexity = 906
|
||||
Company.Example.Library: Line Rate = 27%, Branch Rate = 100%, Complexity = 11
|
||||
```
|
||||
|
||||
#### Markdown Example
|
||||

|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
name: Code Coverage Summary Report
|
||||
uses: irongut/CodeCoverageSummary@master
|
||||
uses: irongut/CodeCoverageSummary@v1
|
||||
with:
|
||||
filename: coverage/coverage.cobertura.xml
|
||||
```
|
||||
@@ -59,7 +60,7 @@ with:
|
||||
### .Net 5 Workflow Example
|
||||
|
||||
```yaml
|
||||
name: CI Build
|
||||
name: .Net 5 CI Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -93,8 +94,44 @@ jobs:
|
||||
run: cp coverage/**/coverage.cobertura.xml coverage/coverage.cobertura.xml
|
||||
|
||||
- name: Code Coverage Summary Report
|
||||
uses: irongut/CodeCoverageSummary@master
|
||||
uses: irongut/CodeCoverageSummary@v1
|
||||
with:
|
||||
filename: coverage/coverage.cobertura.xml
|
||||
badge: 'true'
|
||||
badge: true
|
||||
format: 'markdown'
|
||||
output: 'both'
|
||||
|
||||
- name: Add Coverage PR Comment
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
recreate: true
|
||||
path: code-coverage-results.md
|
||||
```
|
||||
|
||||
## 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 [open a new one][new-issue]. 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][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 `master` 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](LICENSE) file for more info.
|
||||
|
||||
[issues]: https://github.com/irongut/CodeCoverageSummary/issues
|
||||
[new-issue]: https://github.com/irongut/CodeCoverageSummary/issues/new
|
||||
|
||||
Reference in New Issue
Block a user