Collect .NET coverage info (#2023)

## Summary of the Pull Request

Collect .NET coverage during build and display it in GitHub Summary.

## Info on Pull Request

Add the `reportgenerator` tool, run it after tests.

## Validation Steps Performed

Run workflow and make sure it works.

See example coverage output here: https://github.com/microsoft/onefuzz/actions/runs/2458088617
This commit is contained in:
George Pollard
2022-06-08 13:52:31 +12:00
committed by GitHub
parent 60b304a220
commit fe56f6fb29
2 changed files with 17 additions and 2 deletions

View File

@ -267,6 +267,7 @@ jobs:
run: | run: |
cd src/ApiService/ cd src/ApiService/
dotnet restore --locked-mode dotnet restore --locked-mode
dotnet tool restore
- name: Check Formatting - name: Check Formatting
run: | run: |
cd src/ApiService/ cd src/ApiService/
@ -275,10 +276,12 @@ jobs:
run: | run: |
cd src/ApiService/ cd src/ApiService/
dotnet build -warnaserror --configuration Release dotnet build -warnaserror --configuration Release
- name: Test - name: Test & Collect coverage info
run: | run: |
cd src/ApiService/ cd src/ApiService/
dotnet test --no-restore dotnet test --no-restore --collect:"XPlat Code Coverage"
dotnet tool run reportgenerator -reports:Tests/TestResults/*/coverage.cobertura.xml -targetdir:coverage -reporttypes:MarkdownSummary
cat coverage/*.md > $GITHUB_STEP_SUMMARY
- name: copy artifacts - name: copy artifacts
run: | run: |
./src/ci/get-version.sh > src/deployment/VERSION ./src/ci/get-version.sh > src/deployment/VERSION

View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.1.9",
"commands": [
"reportgenerator"
]
}
}
}