Skip to content

Commit 157629d

Browse files
author
Gonzalo Diaz
committed
[CONFIG] Sonarcloud script for github-actions.
1 parent af45cd3 commit 157629d

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.github/workflows/sonarcloud.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,22 @@ jobs:
3939
run: |
4040
New-Item -Path .\.sonar\scanner -ItemType Directory
4141
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
42+
- name: Install Coverlet
43+
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
44+
shell: powershell
45+
run: |
46+
dotnet tool install --global coverlet.console
4247
- name: Build and analyze
4348
env:
4449
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4550
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4651
shell: powershell
4752
run: |
4853
.\.sonar\scanner\dotnet-sonarscanner begin /k:"sir-gon_algorithm-exercises-csharp" /o:"sir-gon" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
49-
dotnet restore
50-
dotnet build --no-restore
51-
dotnet test --no-build --verbosity normal
54+
dotnet build --no-incremental
55+
coverlet .\algorithm-exercises-csharp\bin\Debug\net8.0\algorithm-exercises-csharp-lib.dll
56+
--target "dotnet"
57+
--targetargs "test --no-build"
58+
-f=opencover
59+
-o="coverage.xml"
5260
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,7 @@ _NCrunch*
138138

139139
# Coverage
140140
coverage.cobertura.xml
141+
coverage.opencover.xml
142+
coverage.info
141143
coverage.json
142144
lcov.info

algorithm-exercises-csharp-test/algorithm-exercises-csharp-test.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
<!-- Coverage -->
1515
<CollectCoverage>true</CollectCoverage>
16-
<CoverletOutputFormat>lcov</CoverletOutputFormat>
17-
<CoverletOutput>./lcov.info</CoverletOutput>
16+
<CoverletOutputFormat>lcov,opencover</CoverletOutputFormat>
1817
<IncludeTestAssembly>true</IncludeTestAssembly>
1918

2019
<!-- Static Analysis -->

0 commit comments

Comments
 (0)