Skip to content

Commit 0790409

Browse files
committed
Use xml format for coverage
1 parent 16ef8ef commit 0790409

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

.github/workflows/Steeltoe.All.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ env:
2020
DOTNET_CLI_TELEMETRY_OPTOUT: 1
2121
DOTNET_NOLOGO: true
2222
SOLUTION_FILE: 'src/Steeltoe.All.sln'
23+
TEST_RESULTS_DIRECTORY: '${{ github.workspace }}/AllTestResults'
2324
COMMON_TEST_ARGS: >-
24-
--no-build --configuration Release --coverage --report-trx --results-directory ${{ github.workspace }}/dumps
25+
--no-build --configuration Release --coverage --report-trx --results-directory ${{ env.TEST_RESULTS_DIRECTORY }}
2526
--coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 3m
2627
2728
jobs:
@@ -101,8 +102,8 @@ jobs:
101102
with:
102103
name: FailedTestOutput-${{ matrix.os }}
103104
path: |
104-
${{ github.workspace }}/dumps/**/*.dmp
105-
${{ github.workspace }}/dumps/**/Sequence_*.xml
105+
${{ env.TEST_RESULTS_DIRECTORY }}/*.dmp
106+
${{ env.TEST_RESULTS_DIRECTORY }}/Sequence_*.xml
106107
if-no-files-found: ignore
107108

108109
- name: Report test results
@@ -111,14 +112,14 @@ jobs:
111112
with:
112113
name: ${{ matrix.os }} test results
113114
reporter: dotnet-trx
114-
path: '**/*.trx'
115+
path: '${{ env.TEST_RESULTS_DIRECTORY }}/*.trx'
115116
fail-on-empty: 'true'
116117
fail-on-error: 'false'
117118

118119
- name: Generate code coverage report
119120
uses: danielpalme/ReportGenerator-GitHub-Action@v5
120121
with:
121-
reports: '**/*.coverage'
122+
reports: '${{ env.TEST_RESULTS_DIRECTORY }}/*.xml'
122123
targetdir: 'coveragereport'
123124
reporttypes: 'MarkdownAssembliesSummary;MarkdownSummaryGithub'
124125
filefilters: '-*.g.cs'

.github/workflows/component-shared-workflow.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ env:
2525
DOTNET_CLI_TELEMETRY_OPTOUT: 1
2626
DOTNET_NOLOGO: true
2727
SOLUTION_FILE: 'src/Steeltoe.${{ inputs.component }}.slnf'
28+
TEST_RESULTS_DIRECTORY: '${{ github.workspace }}/AllTestResults'
2829
COMMON_TEST_ARGS: >-
29-
--no-build --configuration Release --coverage --report-trx --results-directory ${{ github.workspace }}/dumps
30+
--no-build --configuration Release --coverage --report-trx --results-directory ${{ env.TEST_RESULTS_DIRECTORY }}
3031
--coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 3m
3132
3233
jobs:
@@ -95,8 +96,8 @@ jobs:
9596
with:
9697
name: FailedTestOutput-${{ inputs.OS }}-latest
9798
path: |
98-
${{ github.workspace }}/dumps/**/*.dmp
99-
${{ github.workspace }}/dumps/**/Sequence_*.xml
99+
${{ env.TEST_RESULTS_DIRECTORY }}/*.dmp
100+
${{ env.TEST_RESULTS_DIRECTORY }}/Sequence_*.xml
100101
if-no-files-found: ignore
101102

102103
- name: Report test results
@@ -105,6 +106,6 @@ jobs:
105106
with:
106107
name: ${{ inputs.OS }}-latest test results
107108
reporter: dotnet-trx
108-
path: '**/*.trx'
109+
path: '${{ env.TEST_RESULTS_DIRECTORY }}/*.trx'
109110
fail-on-empty: 'true'
110111
fail-on-error: 'false'

.github/workflows/sonarcube.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ env:
2121
DOTNET_CLI_TELEMETRY_OPTOUT: 1
2222
DOTNET_NOLOGO: true
2323
SOLUTION_FILE: 'src/Steeltoe.All.sln'
24+
TEST_RESULTS_DIRECTORY: '${{ github.workspace }}/AllTestResults'
2425
SONAR_TEST_ARGS: >-
25-
--no-build --configuration Release --coverage --report-trx --results-directory ${{ github.workspace }}
26+
--no-build --configuration Release --coverage --report-trx --results-directory ${{ env.TEST_RESULTS_DIRECTORY }}
2627
--coverage-settings coverage.config
2728
2829
jobs:
@@ -74,7 +75,7 @@ jobs:
7475
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7576
run: >-
7677
dotnet sonarscanner begin /k:"SteeltoeOSS_steeltoe" /o:"steeltoeoss" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
77-
/d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=**/*.coverage
78+
/d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="${{ env.TEST_RESULTS_DIRECTORY }}/*.xml"
7879
7980
- name: Build solution
8081
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal

coverage.config

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
This file format is documented at https://github.com/microsoft/codecoverage/blob/main/docs/configuration.md.
55
CAUTION: Microsoft Testing Platform uses different defaults, see https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-extensions-code-coverage.
66
-->
7-
<!-- TODO: Try alternate output format that is compatible with Sonar -->
8-
<!--<Format>cobertura</Format>-->
9-
<!-- TODO: Turn off DeterministicReport for Sonar if still incompatible -->
7+
<Format>xml</Format>
8+
<!-- TODO: Restore DeterministicReport (Sonar may not be compatible) -->
109
<!--<DeterministicReport>true</DeterministicReport>-->
1110
<CodeCoverage>
1211
<ModulePaths>

0 commit comments

Comments
 (0)