Skip to content

Commit f72adb0

Browse files
Merge pull request #1 from im-open/im-open
im-open javascript action standards
2 parents 7c638c8 + cb8ad85 commit f72adb0

12 files changed

+1847
-1539
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* @im-open/swat @im-open/infra-purple
2+
/.github/CODEOWNERS @im-open/swat

.github/FUNDING.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build and Test
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- '**.md'
6+
jobs:
7+
build:
8+
runs-on: ${{ matrix.operating-system }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Setup Node.js 14
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 14.x
21+
- name: Build
22+
run: npm run build
23+
- name: Format
24+
run: npm run format
25+
- name: Check for unstaged changes
26+
if: runner.os != 'windows'
27+
run: ./check-for-unstaged-changes.sh
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Increment Version on Merge
2+
on:
3+
pull_request:
4+
types: [closed]
5+
6+
jobs:
7+
increment-version:
8+
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
9+
10+
runs-on: [ubuntu-20.04]
11+
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Increment the version
19+
uses: actions/github-script@v4
20+
with:
21+
github-token: ${{secrets.GITHUB_TOKEN}}
22+
script: |
23+
const util = require('util');
24+
const exec = util.promisify(require('child_process').exec);
25+
26+
let newTag;
27+
try {
28+
({ stdout: tag } = await exec(`git describe --tags --abbrev=0`));
29+
30+
tag = tag.replace('\n', '').trim();
31+
core.info(`The latest tag is: ${tag}`);
32+
const majorMinorPatch = tag.split('.');
33+
const patch = parseInt(majorMinorPatch[2]) + 1;
34+
newTag = `${majorMinorPatch[0]}.${majorMinorPatch[1]}.${patch}`
35+
core.info(`The new tag is: ${newTag}`);
36+
}
37+
catch (error) {
38+
newTag = 'v1.0.0';
39+
core.info('An error occurred getting the tags for the repo. It most likely does not have any tags to use. Defaulting to v1.0.0.');
40+
core.info(error);
41+
}
42+
43+
core.info(`Pushing tag '${newTag}' to the repository...`)
44+
await github.git.createRef({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
ref: `refs/tags/${newTag}`,
48+
sha: context.sha
49+
});

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"semi": true,
5+
"singleQuote": true,
6+
"trailingComma": "none",
7+
"arrowParens": "avoid",
8+
"printWidth": 125
9+
}

README.md

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,93 @@
11
# ReportGenerator
22

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. |
426

527
## Usage
628

729
```yml
8-
- name: Setup .NET Core # Required to execute ReportGenerator
30+
- name: Setup .NET Core # Required to execute ReportGenerator
931
uses: actions/setup-dotnet@v1
1032
with:
1133
dotnet-version: 5.0.301
1234

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+
1339
- name: ReportGenerator
14-
uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12
40+
uses: im-open/code-coverage-report-generator@4.8.12
1541
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'
3056

3157
- name: Upload coverage report artifact
3258
uses: actions/upload-artifact@v2.2.3
3359
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
3679
```
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 &copy; 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

action.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
name: 'ReportGenerator'
2-
author: 'danielpalme'
1+
name: 'code-coverage-report-generator'
32
description: 'Creates coverage reports from tools like OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov'
43
inputs:
54
reports:
65
description: 'The coverage reports that should be parsed (separated by semicolon). Globbing is supported.'
76
required: true
8-
default: 'coverage.xml'
7+
default: '*/**/coverage.opencover.xml'
98
targetdir:
109
description: 'The directory where the generated report should be saved.'
1110
required: true
12-
default: 'coveragereport'
11+
default: 'coverage-results'
1312
reporttypes:
1413
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'
1514
required: false
16-
default: 'HtmlInline;Cobertura'
15+
default: 'Html;MarkdownSummary'
1716
sourcedirs:
1817
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.'
1918
required: false
@@ -62,5 +61,5 @@ runs:
6261
using: 'node12'
6362
main: 'dist/index.js'
6463
branding:
65-
icon: 'bar-chart-2'
64+
icon: 'bar-chart-2'
6665
color: 'green'

check-for-unstaged-changes.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
if [[ "$(git status --porcelain)" != "" ]]; then
4+
echo ----------------------------------------
5+
echo git status
6+
echo ----------------------------------------
7+
git status
8+
echo ----------------------------------------
9+
echo git diff
10+
echo ----------------------------------------
11+
git diff
12+
echo ----------------------------------------
13+
echo Troubleshooting
14+
echo ----------------------------------------
15+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm run build && npm run format"
16+
exit 1
17+
fi

0 commit comments

Comments
 (0)