https://github.com/im-open/code-coverage-report-generator
GitHub Action for ReportGenerator based on: https://danielpalme.github.io/ReportGenerator
https://github.com/im-open/code-coverage-report-generator
code-coverage code-coverage-html code-coverage-summary swat-team test
Last synced: 4 months ago
JSON representation
GitHub Action for ReportGenerator based on: https://danielpalme.github.io/ReportGenerator
- Host: GitHub
- URL: https://github.com/im-open/code-coverage-report-generator
- Owner: im-open
- License: apache-2.0
- Created: 2021-07-22T13:53:59.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T19:21:28.000Z (5 months ago)
- Last Synced: 2025-02-19T06:18:41.415Z (5 months ago)
- Topics: code-coverage, code-coverage-html, code-coverage-summary, swat-team, test
- Language: JavaScript
- Homepage:
- Size: 209 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ReportGenerator
This action is a simplied version of [danielpalme/ReportGenerator-GitHub-Action]. It functions as a wrapper for the [dotnet-reportgenerator-globaltool].
[ReportGenerator] converts coverage reports generated by OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
This action does not generate the code coverage reports itself, those must be created by a previous action.
## Index
- [ReportGenerator](#reportgenerator)
- [Inputs](#inputs)
- [Outputs](#outputs)
- [Usage Examples](#usage-examples)
- [Breaking changes](#breaking-changes)
- [4.9.2 to v5.0.0](#492-to-v500)
- [Contributing](#contributing)
- [Incrementing the Version](#incrementing-the-version)
- [Source Code Changes](#source-code-changes)
- [Recompiling Manually](#recompiling-manually)
- [Updating the README.md](#updating-the-readmemd)
- [Code of Conduct](#code-of-conduct)
- [License](#license)## Inputs
| Parameter | Is Required | Default Value | Description |
|-------------------|-------------|-----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `reports` | false | */**/coverage.opencover.xml | The coverage reports that should be parsed (separated by semicolon). Globbing is supported. |
| `targetdir` | false | coverage-results | The directory where the generated report should be saved. |
| `reporttypes` | false | Html;MarkdownSummary; | The output formats and scope (separated by semicolon)
Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary |
| `assemblyfilters` | false | +* | Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. |
| `classfilters` | false | +* | Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. |
| `filefilters` | false | +* | Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. |
| `verbosity` | false | Info | The verbosity level of the log messages.
Values: Verbose, Info, Warning, Error, Off |
| `title` | false | '' | Optional title. |
| `tag` | false | ${{ github.run_number }}_${{ github.run_id }} | Optional tag or build version. |## Outputs
| Output | Description |
|----------------|----------------------------------------------------------|
| `error-reason` | If there are failures, a brief description of the error. |## Usage Examples
```yml
- name: Setup .NET Core # Required to execute ReportGenerator
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.x # Needs to be 5.0 or higher- name: dotnet test with coverage
continue-on-error: true
run: dotnet test ${{ env.SOLUTION }} --no-restore --logger trx --configuration Release /property:CollectCoverage=True /property:CoverletOutputFormat=opencover- name: ReportGenerator
# You may also reference the major or major.minor version
uses: im-open/[email protected]
with:
reports: '*/**/coverage.opencover.xml'
targetdir: ${{ env.CODE_COVERAGE_DIR }}'
reporttypes: 'Html;MarkdownSummary'
assemblyfilters: '-xunit*;-Dapper;'
classfilters: '+*'
filefilters: '-Startup.cs;-Program.cs;-*.cshtml'
verbosity: 'Warning'
title: ${{ env.CODE_COVERAGE_REPORT_NAME }}
tag: '${{ github.workflow}}_${{ github.run_id }}'
- name: Upload coverage report artifact
uses: actions/upload-artifact@v4
with:
name: Coverage Report
path: ${{ env.CODE_COVERAGE_DIR }}- name: Create a PR comment from the summary file
uses: im-open/process-code-coverage-summary@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
summary-file: '${{ env.CODE_COVERAGE_DIR }}/Summary.md'
create-pr-comment: true
create-status-check: false
```## Breaking changes
### 4.9.2 to v5.0.0
- The `toolpath` input was removed since it was underutilized. `v5` and above will check for the presence of the tool in the `./reportgeneratortool` directory, which was the default location in prior versions. If that directory does not exist, the tool will be installed with `v4.8.12`. If desired, a different version of the global tool can be installed in this location prior to this action but different versions of the report generator tool may or may not be compatible with this action's code.
- The `4.8.12` version of the tool is older but will continue to be used to preserve metrics in the generated reports that newer versions no longer produce.
- The following inputs were not utilized and have been removed completely from the action starting with `v5`.
- `sourcedirs`
- `historydir`
- `plugins`
- `customSettings`
- Previously, each version of the action had two tags, one with the `v` prefix and one without it. There will only be one tag per version going forward and it includes the `v` prefix.## Contributing
When creating PRs, please review the following guidelines:
- [ ] The action code does not contain sensitive information.
- [ ] At least one of the commit messages contains the appropriate `+semver:` keywords listed under [Incrementing the Version] for major and minor increments.
- [ ] The action has been recompiled. See [Recompiling Manually] for details.
- [ ] The README.md has been updated with the latest version of the action. See [Updating the README.md] for details.### Incrementing the Version
This repo uses [git-version-lite] in its workflows to examine commit messages to determine whether to perform a major, minor or patch increment on merge if [source code] changes have been made. The following table provides the fragment that should be included in a commit message to active different increment strategies.
| Increment Type | Commit Message Fragment |
|----------------|---------------------------------------------|
| major | +semver:breaking |
| major | +semver:major |
| minor | +semver:feature |
| minor | +semver:minor |
| patch | *default increment type, no comment needed* |### Source Code Changes
The files and directories that are considered source code are listed in the `files-with-code` and `dirs-with-code` arguments in both the [build-and-review-pr] and [increment-version-on-merge] workflows.
If a PR contains source code changes, the README.md should be updated with the latest action version and the action should be recompiled. The [build-and-review-pr] workflow will ensure these steps are performed when they are required. The workflow will provide instructions for completing these steps if the PR Author does not initially complete them.
If a PR consists solely of non-source code changes like changes to the `README.md` or workflows under `./.github/workflows`, version updates and recompiles do not need to be performed.
### Recompiling Manually
This command utilizes [esbuild] to bundle the action and its dependencies into a single file located in the `dist` folder. If changes are made to the action's [source code], the action must be recompiled by running the following command:
```sh
# Installs dependencies and bundles the code
npm run build
```### Updating the README.md
If changes are made to the action's [source code], the [usage examples] section of this file should be updated with the next version of the action. Each instance of this action should be updated. This helps users know what the latest tag is without having to navigate to the Tags page of the repository. See [Incrementing the Version] for details on how to determine what the next version will be or consult the first workflow run for the PR which will also calculate the next version.
## Code of Conduct
This project has adopted the [im-open's Code of Conduct](https://github.com/im-open/.github/blob/main/CODE_OF_CONDUCT.md).
## License
Copyright © 2024, Extend Health, LLC. Code released under the [MIT license](LICENSE).
[Incrementing the Version]: #incrementing-the-version
[Recompiling Manually]: #recompiling-manually
[Updating the README.md]: #updating-the-readmemd
[source code]: #source-code-changes
[usage examples]: #usage-examples
[build-and-review-pr]: ./.github/workflows/build-and-review-pr.yml
[increment-version-on-merge]: ./.github/workflows/increment-version-on-merge.yml
[esbuild]: https://esbuild.github.io/getting-started/#bundling-for-node
[git-version-lite]: https://github.com/im-open/git-version-lite
[dotnet-reportgenerator-globaltool]: https://www.nuget.org/packages/dotnet-reportgenerator-globaltool