Compare commits

...

3 Commits

Author SHA1 Message Date
irongut 065eaf7bb5 prepare v1.1.0 release 2021-10-27 22:35:09 +01:00
irongut a5c4e90cbe updated readme 2021-10-27 00:41:20 +01:00
irongut f89139ddac updated test action 2021-10-26 23:53:11 +01:00
3 changed files with 26 additions and 19 deletions
+4 -2
View File
@@ -2,7 +2,6 @@ name: Test Linux Runner
on: on:
workflow_dispatch: workflow_dispatch:
branches: [master]
permissions: permissions:
contents: read contents: read
@@ -15,4 +14,7 @@ jobs:
uses: irongut/CodeCoverageSummary@master uses: irongut/CodeCoverageSummary@master
with: with:
filename: '/app/sample.coverage.xml' filename: '/app/sample.coverage.xml'
badge: 'true' badge: true
format: 'md'
fail_below_min: true
thresholds: '60 80'
+21 -16
View File
@@ -8,32 +8,36 @@ As a Docker based action Code Coverage Summary requires a Linux runner, see [Typ
## Inputs ## Inputs
#### `filename` ### `filename`
**Required** **Required**
Code coverage file to analyse. 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 the [.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` ### `badge`
Include a badge reporting the Line Rate coverage 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 the overall Line Rate is less than the lower threshold (50%) the badge will be red, if it is between thresholds it will be yellow and if it greater than or equal to the higher threshold (75%) it will be green. See [`thresholds`](#thresholds) to change these values. Line Rate | Badge
--------- | -----
less than lower threshold (50%) | ![Code Coverage](https://img.shields.io/badge/Code%20Coverage-45%25-critical?style=flat)
between thresholds (50% - 74%) | ![Code Coverage](https://img.shields.io/badge/Code%20Coverage-65%25-yellow?style=flat)
equal or greater than upper threshold (75%) | ![Code Coverage](https://img.shields.io/badge/Code%20Coverage-83%25-success?style=flat)
#### `fail_below_min` See [`thresholds`](#thresholds) to change these values.
**v1.1.0-beta only**
### `fail_below_min`
Fail the workflow if the overall Line Rate is below lower threshold - `true` or `false` (default). The default lower threshold is 50%, see [`thresholds`](#thresholds). Fail the workflow if the overall Line Rate is below lower threshold - `true` or `false` (default). The default lower threshold is 50%, see [`thresholds`](#thresholds).
#### `format` ### `format`
Output Format - `markdown` or `text` (default). Output Format - `markdown` or `text` (default).
#### `indicators` ### `indicators`
**v1.1.0-beta only**
Include health indicators in the output - `true` (default) or `false`.' Include health indicators in the output - `true` (default) or `false`.
Line Rate | Indicator Line Rate | Indicator
--------- | --------- --------- | ---------
@@ -43,7 +47,7 @@ equal or greater than upper threshold (75%) | ✔
See [`thresholds`](#thresholds) to change these values. See [`thresholds`](#thresholds) to change these values.
#### `output` ### `output`
Output Type - `console` (default), `file` or `both`. Output Type - `console` (default), `file` or `both`.
@@ -53,14 +57,13 @@ Output Type - `console` (default), `file` or `both`.
`both` will output the coverage summary to the Action log and a file as above. `both` will output the coverage summary to the Action log and a file as above.
#### `thresholds` ### `thresholds`
**v1.1.0-beta only**
Lower and upper threshold percentages for badge and health indicators, lower threshold can also be used to fail the action. Separate the values with a space and enclose them in quotes; default `'50 75'`. Lower and upper threshold percentages for badge and health indicators, lower threshold can also be used to fail the action. Separate the values with a space and enclose them in quotes; default `'50 75'`.
## Outputs ## Outputs
#### Text Example ### Text Example
``` ```
https://img.shields.io/badge/Code%20Coverage-83%25-success?style=flat https://img.shields.io/badge/Code%20Coverage-83%25-success?style=flat
@@ -70,14 +73,14 @@ Summary: Line Rate = 83% (1212 / 1460), Branch Rate = 69% (262 / 378), Complexit
Minimum allowed line rate is 50% Minimum allowed line rate is 50%
``` ```
#### Markdown Example ### Markdown Example
![image](https://user-images.githubusercontent.com/27953302/117726304-4ac1c100-b1de-11eb-8d9a-6286ba1f5523.png) ![image](https://user-images.githubusercontent.com/27953302/117726304-4ac1c100-b1de-11eb-8d9a-6286ba1f5523.png)
## Usage ## Usage
```yaml ```yaml
name: Code Coverage Summary Report name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.0.5 uses: irongut/CodeCoverageSummary@v1.1.0
with: with:
filename: coverage/coverage.cobertura.xml filename: coverage/coverage.cobertura.xml
``` ```
@@ -119,12 +122,14 @@ jobs:
run: cp coverage/**/coverage.cobertura.xml coverage/coverage.cobertura.xml run: cp coverage/**/coverage.cobertura.xml coverage/coverage.cobertura.xml
- name: Code Coverage Summary Report - name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.0.5 uses: irongut/CodeCoverageSummary@v1.1.0
with: with:
filename: coverage/coverage.cobertura.xml filename: coverage/coverage.cobertura.xml
badge: true badge: true
fail_below_min: true
format: 'markdown' format: 'markdown'
output: 'both' output: 'both'
thresholds: '70 80'
- name: Add Coverage PR Comment - name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2 uses: marocchino/sticky-pull-request-comment@v2
+1 -1
View File
@@ -34,7 +34,7 @@ inputs:
default: '50 75' default: '50 75'
runs: runs:
using: 'docker' using: 'docker'
image: 'docker://ghcr.io/irongut/codecoveragesummary:v1.1.0-beta' image: 'docker://ghcr.io/irongut/codecoveragesummary:v1.1.0'
args: args:
- ${{ inputs.filename }} - ${{ inputs.filename }}
- '--badge' - '--badge'