Skip to content

Commit 2dafcb8

Browse files
committed
update code coverage logic
1 parent b59c0c9 commit 2dafcb8

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/Build.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ jobs:
4040
with:
4141
dotnet-version: ${{ env.DOTNET_VERSION }}
4242

43+
- name: Install dotnet-coverage
44+
shell: powershell
45+
run: dotnet tool install --global dotnet-coverage
46+
4347
- name: Install SonarCloud scanner
4448
shell: powershell
4549
run: |
@@ -58,7 +62,7 @@ jobs:
5862
- name: Analyze solution
5963
shell: powershell
6064
run: |
61-
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ env.SONAR_PROJECT }}" /o:"${{ env.SONAR_ORGANIZATION }}" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST }}"
65+
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{ env.SONAR_PROJECT }}" /o:"${{ env.SONAR_ORGANIZATION }}" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="${{ env.SONAR_HOST }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
6266
dotnet build -c ${{ env.DOTNET_BUILD_CONFIGURATION }}
63-
dotnet test --no-build -c ${{ env.DOTNET_BUILD_CONFIGURATION }} --logger trx --verbosity normal
64-
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}"
67+
dotnet-coverage collect "dotnet test -c ${{ env.DOTNET_BUILD_CONFIGURATION }}" -f xml -o "coverage.xml"
68+
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}"

0 commit comments

Comments
 (0)