Skip to content

Commit cfd6c52

Browse files
committed
updated workflow
1 parent de37dfc commit cfd6c52

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/dotnet.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ jobs:
8989
path: .\.sonar\scanner
9090
key: ${{ runner.os }}-sonar-scanner
9191
restore-keys: ${{ runner.os }}-sonar-scanner
92+
- name: Cache dotnet-coverage
93+
id: cache-dotnet-coverage
94+
uses: actions/cache@v1
95+
with:
96+
path: .\.dotnet-coverage\dotnet-coverage
97+
key: ${{ runner.os }}-dotnet-coverage
98+
restore-keys: ${{ runner.os }}-dotnet-coverage
9299
- name: Setup dotNET
93100
uses: actions/setup-dotnet@v3
94101
with:
@@ -99,16 +106,24 @@ jobs:
99106
run: |
100107
New-Item -Path .\.sonar\scanner -ItemType Directory
101108
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
109+
- name: Install dotnet-coverage
110+
if: steps.cache-dotnet-coverage.outputs.cache-hit != 'true'
111+
shell: powershell
112+
run: |
113+
New-Item -Path .\.dotnet-coverage\dotnet-coverage -ItemType Directory
114+
dotnet tool update dotnet-coverage --tool-path .\.dotnet-coverage\dotnet-coverage
102115
- name: Build and analyze
103116
env:
104117
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
105118
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
106119
shell: powershell
107120
run: |
108121
cd .\src
109-
.\..\.sonar\scanner\dotnet-sonarscanner begin /k:"jjm-one_jjm.one.Serilog.Extensions.Logging.Helpers" /o:"jjm-one" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
122+
.\..\.sonar\scanner\dotnet-sonarscanner begin /k:"jjm-one_jjm.one.Serilog.Extensions.Logging.Helpers" /o:"jjm-one" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
110123
dotnet restore
111-
dotnet build --no-restore
124+
dotnet build --no-restore -c Debug
125+
.\..\.dotnet-coverage\dotnet-coverage\dotnet-coverage collect "dotnet test --no-build --verbosity normal" -f xml -o "coverage.xml"
126+
cat coverage.xml
112127
.\..\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
113128
114129
#publish-nuget:

0 commit comments

Comments
 (0)