|
1 | 1 | # ReportGenerator
|
2 | 2 |
|
3 |
| -[ReportGenerator](https://github.com/danielpalme/ReportGenerator) converts coverage reports generated by OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats. |
| 3 | +This action is based on [danielpalme/ReportGenerator-GitHub-Action]. |
| 4 | + |
| 5 | +[ReportGenerator] converts coverage reports generated by OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats. |
| 6 | + |
| 7 | +This action does not generate the code coverage reports itself, those must be created by a previous action. |
| 8 | + |
| 9 | +## Inputs |
| 10 | +| Parameter | Is Required | Default Value | Description | |
| 11 | +| ----------------- | ----------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 12 | +| `reports` | false | */**/coverage.opencover.xml | The coverage reports that should be parsed (separated by semicolon). Globbing is supported. | |
| 13 | +| `targetdir` | false | coverage-results | The directory where the generated report should be saved. | |
| 14 | +| `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 | |
| 15 | +| `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. | |
| 16 | +| `historydir` | false | '' | Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. | |
| 17 | +| `plugins` | false | '' | Optional plugin files for custom reports or custom history storage (separated by semicolon). | |
| 18 | +| `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. | |
| 19 | +| `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. | |
| 20 | +| `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. | |
| 21 | +| `verbosity` | false | Info | The verbosity level of the log messages. <br/>Values: Verbose, Info, Warning, Error, Off | |
| 22 | +| `title` | false | '' | Optional title. | |
| 23 | +| `tag` | false | ${{ github.run_number }}_${{ github.run_id }} | Optional tag or build version. | |
| 24 | +| `customSettings` | false | '' | Optional custom settings (separated by semicolon). See [Settings]. | |
| 25 | +| `toolpath` | false | reportgeneratortool | Default directory for installing the dotnet tool. | |
4 | 26 |
|
5 | 27 | ## Usage
|
6 | 28 |
|
7 | 29 | ```yml
|
8 |
| -- name: Setup .NET Core # Required to execute ReportGenerator |
| 30 | +- name: Setup .NET Core # Required to execute ReportGenerator |
9 | 31 | uses: actions/setup-dotnet@v1
|
10 | 32 | with:
|
11 | 33 | dotnet-version: 5.0.301
|
12 | 34 |
|
| 35 | +- name: dotnet test with coverage |
| 36 | + continue-on-error: true |
| 37 | + run: dotnet test ${{ env.SOLUTION }} --no-restore --logger trx --configuration Release /property:CollectCoverage=True /property:CoverletOutputFormat=opencover |
| 38 | + |
13 | 39 | - name: ReportGenerator
|
14 |
| - uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12 |
| 40 | + uses: im-open/code-coverage-report-generator@4.8.12 |
15 | 41 | with:
|
16 |
| - reports: 'coverage.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported. |
17 |
| - targetdir: 'coveragereport' # REQUIRED # The directory where the generated report should be saved. |
18 |
| - reporttypes: 'HtmlInline;Cobertura' # 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 |
19 |
| - sourcedirs: '' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information. |
20 |
| - historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution. |
21 |
| - plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon). |
22 |
| - assemblyfilters: '+*' # Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. |
23 |
| - classfilters: '+*' # Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. |
24 |
| - filefilters: '+*' # Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed. |
25 |
| - verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off |
26 |
| - title: '' # Optional title. |
27 |
| - tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version. |
28 |
| - customSettings: '' # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings. |
29 |
| - toolpath: 'reportgeneratortool' # Default directory for installing the dotnet tool. |
| 42 | + reports: '*/**/coverage.opencover.xml' |
| 43 | + targetdir: ${{ env.CODE_COVERAGE_DIR }}' |
| 44 | + reporttypes: 'Html;MarkdownSummary' |
| 45 | + sourcedirs: '' |
| 46 | + historydir: '' |
| 47 | + plugins: '' |
| 48 | + assemblyfilters: '-xunit*;-Dapper;' |
| 49 | + classfilters: '+*' |
| 50 | + filefilters: '-Startup.cs;-Program.cs;-*.cshtml' |
| 51 | + verbosity: 'Warning' |
| 52 | + title: ${{ env.CODE_COVERAGE_REPORT_NAME }} |
| 53 | + tag: '${{ github.workflow}}_${{ github.run_id }}' |
| 54 | + customSettings: '' |
| 55 | + toolpath: 'reportgeneratortool' |
30 | 56 |
|
31 | 57 | - name: Upload coverage report artifact
|
32 | 58 | uses: actions/upload-artifact@v2.2.3
|
33 | 59 | with:
|
34 |
| - name: CoverageReport # Artifact name |
35 |
| - path: coveragereport # Directory containing files to upload |
| 60 | + name: Coverage Report |
| 61 | + path: ${{ env.CODE_COVERAGE_DIR }} |
| 62 | + |
| 63 | +- name: Create a PR comment from the summary file |
| 64 | + uses: im-open/process-code-coverage-summary@v1.0.0 |
| 65 | + with: |
| 66 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + summary-file: '${{ env.CODE_COVERAGE_DIR }}/Summary.md' |
| 68 | + create-pr-comment: true |
| 69 | + create-status-check: false |
| 70 | +``` |
| 71 | +
|
| 72 | +## Recompiling |
| 73 | +
|
| 74 | +If changes are made to the action's code in this repository, or its dependencies, you will need to re-compile the action. |
| 75 | +
|
| 76 | +```sh |
| 77 | +# Installs dependencies and bundles the code |
| 78 | +npm run build |
36 | 79 | ```
|
| 80 | + |
| 81 | +These commands utilize [ncc](https://github.com/vercel/ncc) to bundle the action and its dependencies into a single file located in the `dist` folder. |
| 82 | + |
| 83 | +## Code of Conduct |
| 84 | + |
| 85 | +This project has adopted the [im-open's Code of Conduct](https://github.com/im-open/.github/blob/master/CODE_OF_CONDUCT.md). |
| 86 | + |
| 87 | +## License |
| 88 | + |
| 89 | +Copyright © 2021, Extend Health, LLC. Code released under the [MIT license](LICENSE). |
| 90 | + |
| 91 | +[danielpalme/ReportGenerator-GitHub-Action]: https://github.com/danielpalme/ReportGenerator-GitHub-Action |
| 92 | +[ReportGenerator]: https://github.com/danielpalme/ReportGenerator |
| 93 | +[Settings]: https://github.com/danielpalme/ReportGenerator/wiki/Settings |
0 commit comments