Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARCH-2011 - Adding tests #8

Merged
merged 8 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
424 changes: 424 additions & 0 deletions .github/workflows/build-and-review-pr.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ lib/
node_modules
/.vscode/launch.json
reportgeneratortool
src/*.js
test-results/
47 changes: 29 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ReportGenerator

This action is based on [danielpalme/ReportGenerator-GitHub-Action].
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.

Expand All @@ -10,7 +10,10 @@ This action does not generate the code coverage reports itself, those must be cr

- [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)
Expand All @@ -26,51 +29,48 @@ This action does not generate the code coverage reports itself, those must be cr
| `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)<br/>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 |
| `sourcedirs` | false | '' | Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information. |
| `historydir` | false | '' | Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. |
| `plugins` | false | '' | Optional plugin files for custom reports or custom history storage (separated by semicolon). |
| `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. <br/>Values: Verbose, Info, Warning, Error, Off |
| `title` | false | '' | Optional title. |
| `tag` | false | ${{ github.run_number }}_${{ github.run_id }} | Optional tag or build version. |
| `customSettings` | false | '' | Optional custom settings (separated by semicolon). See [Settings]. |
| `toolpath` | false | reportgeneratortool | Default directory for installing the dotnet tool. |

## 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: 5.0.301
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/code-coverage-report-generator@4.9.2
uses: im-open/code-coverage-report-generator@v5.0.0
with:
reports: '*/**/coverage.opencover.xml'
targetdir: ${{ env.CODE_COVERAGE_DIR }}'
reporttypes: 'Html;MarkdownSummary'
sourcedirs: ''
historydir: ''
plugins: ''
assemblyfilters: '-xunit*;-Dapper;'
classfilters: '+*'
filefilters: '-Startup.cs;-Program.cs;-*.cshtml'
verbosity: 'Warning'
title: ${{ env.CODE_COVERAGE_REPORT_NAME }}
tag: '${{ github.workflow}}_${{ github.run_id }}'
customSettings: ''
toolpath: 'reportgeneratortool'


- name: Upload coverage report artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v4
with:
name: Coverage Report
path: ${{ env.CODE_COVERAGE_DIR }}
Expand All @@ -84,6 +84,19 @@ This action does not generate the code coverage reports itself, those must be cr
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:
Expand Down Expand Up @@ -132,7 +145,7 @@ This project has adopted the [im-open's Code of Conduct](https://github.com/im-o

## License

Copyright &copy; 2023, Extend Health, LLC. Code released under the [MIT license](LICENSE).
Copyright &copy; 2024, Extend Health, LLC. Code released under the [MIT license](LICENSE).

<!-- Links -->
[Incrementing the Version]: #incrementing-the-version
Expand All @@ -144,6 +157,4 @@ Copyright &copy; 2023, Extend Health, LLC. Code released under the [MIT license]
[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
[danielpalme/ReportGenerator-GitHub-Action]: https://github.com/danielpalme/ReportGenerator-GitHub-Action
[ReportGenerator]: https://github.com/danielpalme/ReportGenerator
[Settings]: https://github.com/danielpalme/ReportGenerator/wiki/Settings
[dotnet-reportgenerator-globaltool]: https://www.nuget.org/packages/dotnet-reportgenerator-globaltool
115 changes: 50 additions & 65 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,50 @@
name: 'code-coverage-report-generator'
description: 'Creates coverage reports from tools like OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov'
inputs:
reports:
description: 'The coverage reports that should be parsed (separated by semicolon). Globbing is supported.'
required: true
default: '*/**/coverage.opencover.xml'
targetdir:
description: 'The directory where the generated report should be saved.'
required: true
default: 'coverage-results'
reporttypes:
description: '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, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary'
required: false
default: 'Html;MarkdownSummary'
sourcedirs:
description: 'Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information.'
required: false
default: ''
historydir:
description: 'Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.'
required: false
default: ''
toolpath:
description: 'Default directory for installing the dotnet tool.'
required: false
default: 'reportgeneratortool'
plugins:
description: 'Optional plugin files for custom reports or custom history storage (separated by semicolon).'
required: false
default: ''
assemblyfilters:
description: 'Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.'
required: false
default: '+*'
classfilters:
description: 'Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.'
required: false
default: '+*'
filefilters:
description: 'Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.'
required: false
default: '+*'
verbosity:
description: 'The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off'
required: false
default: 'Info'
title:
description: 'Optional title.'
required: false
default: ''
tag:
description: 'Optional tag or build version.'
required: false
default: '${{ github.run_number }}_${{ github.run_id }}'
customSettings:
description: 'Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings'
required: false
default: ''
runs:
using: 'node16'
main: 'dist/index.js'
branding:
icon: 'bar-chart-2'
color: 'green'
name: 'code-coverage-report-generator'
description: 'Creates coverage reports from tools like OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov'
inputs:
reports:
description: 'The coverage reports that should be parsed (separated by semicolon). Globbing is supported.'
required: true
default: '*/**/coverage.opencover.xml'
targetdir:
description: 'The directory where the generated report should be saved.'
required: true
default: 'coverage-results'
reporttypes:
description: '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'
required: false
default: 'Html;MarkdownSummary'
assemblyfilters:
description: 'Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.'
required: false
default: '+*'
classfilters:
description: 'Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.'
required: false
default: '+*'
filefilters:
description: 'Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.'
required: false
default: '+*'
verbosity:
description: 'The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off'
required: false
default: 'Info'
title:
description: 'Optional title.'
required: false
default: ''
tag:
description: 'Optional tag or build version.'
required: false
default: '${{ github.run_number }}_${{ github.run_id }}'

outputs:
error-reason:
description: 'If there are failures, a brief description of the error.'
runs:
using: 'node20'
main: 'dist/index.js'

branding:
icon: 'bar-chart-2'
color: 'green'
Loading
Loading