Skip to content

Commit 15ab572

Browse files
committed
Try to get branch coverage in Sonar
1 parent 3a58eff commit 15ab572

File tree

4 files changed

+20
-35
lines changed

4 files changed

+20
-35
lines changed

.github/workflows/Steeltoe.All.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323
SOLUTION_FILE: 'src/Steeltoe.All.sln'
2424
TEST_OUTPUT_DIRECTORY: '${{ github.workspace }}/TestOutput'
2525
COMMON_TEST_ARGS: >-
26-
--no-build --no-progress --configuration Release --results-directory ${{ github.workspace }}/TestOutput
26+
--no-build --no-progress --configuration Release --results-directory '${{ github.workspace }}/TestOutput'
2727
--report-trx --coverage --coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 1m
2828
2929
jobs:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ env:
2525
SOLUTION_FILE: 'src/Steeltoe.${{ inputs.component }}.slnf'
2626
TEST_OUTPUT_DIRECTORY: '${{ github.workspace }}/TestOutput'
2727
COMMON_TEST_ARGS: >-
28-
--no-build --no-progress --configuration Release --results-directory ${{ github.workspace }}/TestOutput
29-
--report-trx --coverage --coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 1m
28+
--no-build --no-progress --configuration Release --results-directory '${{ github.workspace }}/TestOutput'
29+
--report-trx --coverage --coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 1m
3030
3131
jobs:
3232
build:

.github/workflows/sonarcube.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ env:
2424
SOLUTION_FILE: 'src/Steeltoe.All.sln'
2525
TEST_OUTPUT_DIRECTORY: '${{ github.workspace }}/TestOutput'
2626
SONAR_TEST_ARGS: >-
27-
--no-build --no-progress --configuration Release --results-directory ${{ github.workspace }}/TestOutput
28-
--report-trx --coverage --coverage-settings coverage.sonar.config
27+
--no-build --no-progress --configuration Release --results-directory '${{ github.workspace }}/TestOutput'
28+
--report-trx --coverage --coverage-settings coverage.config
2929
3030
jobs:
3131
analyze:
@@ -78,7 +78,7 @@ jobs:
7878
# TODO: Revert to OpenCover, see https://github.com/microsoft/testfx/issues/7104
7979
# /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
8080
dotnet sonarscanner begin /k:"SteeltoeOSS_steeltoe" /o:"steeltoeoss" /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
81-
/d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="${{ env.TEST_OUTPUT_DIRECTORY }}/*.xml"
81+
/d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths=TestOutput/SonarQube.xml
8282
8383
- name: Build solution
8484
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal
@@ -89,6 +89,20 @@ jobs:
8989
- name: Test (memory dumps)
9090
run: dotnet test --project src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj --filter-trait "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }}
9191

92+
- name: 'TEMP: List files before coverage conversion'
93+
run: find ${{ env.TEST_OUTPUT_DIRECTORY }}
94+
95+
- name: Convert Cobertura to Sonar format using ReportGenerator
96+
uses: danielpalme/[email protected]
97+
with:
98+
reports: '${{ env.TEST_OUTPUT_DIRECTORY }}/*cobertura.xml'
99+
targetdir: '${{ env.TEST_OUTPUT_DIRECTORY }}'
100+
reporttypes: 'SonarQube'
101+
filefilters: '-*.g.cs'
102+
103+
- name: 'TEMP: List files after coverage conversion'
104+
run: find ${{ env.TEST_OUTPUT_DIRECTORY }}
105+
92106
- name: End Sonar .NET scanner
93107
if: ${{ !cancelled() && steps.sonar_begin.outcome == 'success' }}
94108
env:

coverage.sonar.config

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

0 commit comments

Comments
 (0)