Skip to content

Commit cb48ff8

Browse files
Describe coverage results and thresholds directly
1 parent 11e54fa commit cb48ff8

1 file changed

Lines changed: 39 additions & 38 deletions

File tree

  • .github/actions/Get-PesterCodeCoverage

‎.github/actions/Get-PesterCodeCoverage/README.md‎

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Get-PesterCodeCoverage
22

3-
A GitHub Action that aggregates Pester code coverage reports and generates a detailed summary with coverage statistics.
4-
Fails the workflow if coverage falls below specified targets.
3+
This GitHub Action collects Pester code coverage reports and writes a summary of coverage statistics.
4+
If coverage is below the specified target, the action fails the workflow.
55

6-
This GitHub Action is a part of the [PSModule framework](https://github.com/PSModule). It is recommended to use the
7-
[Process-PSModule workflow](https://github.com/PSModule/Process-PSModule) to automate the whole process of managing the PowerShell module.
6+
The [PSModule framework](https://github.com/PSModule) includes this action.
7+
For the recommended setup, use the [Process-PSModule workflow](https://github.com/PSModule/Process-PSModule) to automate PowerShell module management.
88

99
## Features
1010

11-
- Combines multiple code coverage reports from parallel test runs
12-
- Generates Markdown/HTML tables showing missed & executed commands
13-
- Displays analyzed files and coverage statistics
14-
- Generates a generic missed-path report (Markdown + JSON)
15-
- Configurable step summary sections
16-
- Threshold enforcement for minimum code coverage
11+
- Collects code coverage reports from parallel test runs.
12+
- Writes Markdown and HTML tables of missed and executed commands.
13+
- Shows analyzed files and coverage statistics.
14+
- Writes a missed-path report in Markdown and JSON.
15+
- Selects step summary sections from the action input.
16+
- Fails the workflow if coverage is below the target.
1717

1818
## Usage
1919

@@ -26,10 +26,10 @@ This GitHub Action is a part of the [PSModule framework](https://github.com/PSMo
2626
| `Version` | Version of the GitHub module to install; accepts an exact version or a NuGet version range (for example `[1.2.0, 2.0.0)`) | No | Latest |
2727
| `Prerelease` | Allow prerelease versions | No | `false` |
2828
| `WorkingDirectory` | Working directory for the action | No | `.` |
29-
| `StepSummary_Mode` | Controls which sections to show in the GitHub step summary. Use 'Full' for all sections, 'None' to disable, or a comma-separated list of 'Missed, Executed, Files'. | No | `Missed, Files` |
29+
| `StepSummary_Mode` | Select the sections in the GitHub step summary. Use 'Full' for all sections, 'None' to disable, or a comma-separated list of 'Missed, Executed, Files'. | No | `Missed, Files` |
3030
| `CodeCoveragePercentTarget` | Target code coverage percentage | No | Max target from individual reports |
3131

32-
### Example Workflow
32+
### Example workflow
3333

3434
```yaml
3535
- name: Process Code Coverage
@@ -43,22 +43,22 @@ This GitHub Action is a part of the [PSModule framework](https://github.com/PSMo
4343
4444
| Name | Description |
4545
| ---- | ----------- |
46-
| `MissedPathReportPath` | Folder path containing `CodeCoverage-MissedPaths.md` and `CodeCoverage-MissedPaths.json` |
46+
| `MissedPathReportPath` | Path to the folder with `CodeCoverage-MissedPaths.md` and `CodeCoverage-MissedPaths.json` |
4747

48-
### GitHub Step Summary
48+
### GitHub step summary
4949

50-
The action generates a detailed summary visible in the GitHub Actions UI:
50+
The action writes a detailed summary to the GitHub Actions UI:
5151

52-
1. **Coverage Overview Table**
53-
- Coverage percentage vs target
54-
- Analyzed/executed/missed command counts
55-
- Number of files analyzed
52+
1. **Coverage overview table**
53+
- Coverage percentage and target
54+
- Analyzed, executed, and missed command counts
55+
- Number of analyzed files
5656

57-
2. **Expandable Sections**
58-
- **Missed Commands**: HTML table with code snippets
59-
- **Executed Commands**: HTML table with code snippets
60-
- **Analyzed Files**: List of covered files
61-
- **Missed Paths**: Aggregated missed-command counts grouped by file path
57+
2. **Expandable sections**
58+
- **Missed commands**: HTML table with code snippets
59+
- **Executed commands**: HTML table with code snippets
60+
- **Analyzed files**: List of covered files
61+
- **Missed paths**: Missed-command counts for each file path
6262

6363
Example summary:
6464

@@ -77,10 +77,10 @@ Summary:
7777

7878
## Requirements
7979

80-
1. **Pester 6.1 Code Coverage Reports**
80+
1. **Pester 6.1 code coverage reports**
8181

82-
Preceding steps must generate JSON coverage reports named `*-CodeCoverage*.json`
83-
from the Pester 6.1 `CodeCoverage` result object. The action consumes
82+
Earlier steps must create JSON coverage reports named `*-CodeCoverage*.json`
83+
from the Pester 6.1 `CodeCoverage` result object. The action reads
8484
`CoveragePercent`, `CoveragePercentTarget`, `CommandsMissed`,
8585
`CommandsExecuted`, and `FilesAnalyzed` plus their count properties.
8686

@@ -89,18 +89,19 @@ Summary:
8989

9090
## Behavior
9191

92-
1. **Coverage Calculation**
93-
- Combines multiple coverage reports
94-
- Removes duplicate entries
95-
- Calculates aggregate coverage percentage
92+
1. **Coverage calculation**
93+
- Collects multiple coverage reports.
94+
- Removes duplicate entries.
95+
- Calculates the total coverage percentage across all reports.
9696

97-
2. **Threshold Enforcement**
98-
Fails the workflow if coverage is below either:
99-
- Explicitly specified `CodeCoveragePercentTarget`
100-
- Highest target from individual reports (if no target specified)
97+
2. **Threshold enforcement**
98+
If coverage is below the applicable target, the action fails the workflow.
99+
The action uses:
100+
- The explicit `CodeCoveragePercentTarget` value, if the input has a value.
101+
- The highest target from individual reports, if the input has no value.
101102

102-
3. **Output Control**
103-
Configure visibility of sections using `StepSummary_Mode`:
103+
3. **Output control**
104+
Use `StepSummary_Mode` to select the summary sections:
104105
```yaml
105106
# Show all sections
106107
StepSummary_Mode: Full
@@ -114,7 +115,7 @@ Summary:
114115

115116
## Troubleshooting
116117

117-
Enable debugging by setting inputs:
118+
To get debug and verbose output, set these inputs:
118119
```yaml
119120
with:
120121
Debug: true

0 commit comments

Comments
 (0)