99jobs :
1010 build :
1111 runs-on : ubuntu-latest
12- if : github.event_name == 'push'
1312 steps :
1413 - name : Dump GitHub context
1514 env :
@@ -22,36 +21,46 @@ jobs:
2221 - name : Setup .NET Core
2322 uses : actions/setup-dotnet@v1
2423 with :
25- dotnet-version : 3.1.300
24+ dotnet-version : 3.1.301
2625 - name : Restore dotnet tools
2726 run : dotnet tool restore
27+ - name : Prepare sonarqube
28+ run : dotnet sonarscanner begin -d:sonar.host.url=https://sonarcloud.io -organization:dnperfors-github -key:dnperfors_TestableHttpClient -version:`dotnet gitversion -showvariable semver` -d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml -d:sonar.login=${{secrets.SONARCLOUD_TOKEN}}
2829 - name : Restore dependencies
2930 run : dotnet restore
3031 - name : Build source code
3132 run : dotnet build --configuration Release --no-restore
3233 - name : Test with dotnet
33- run : dotnet test --configuration Release --no-build
34+ run : dotnet test --configuration Release --no-build --collect="Code Coverage"
35+ - name : Upload sonarqube results
36+ env :
37+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38+ run : dotnet sonarscanner end -d:sonar.login=${{secrets.SONARCLOUD_TOKEN}}
3439 - name : Check source file format
3540 run : dotnet format --folder . --check --dry-run # --folder is used to supress warnings: https://github.com/dotnet/format/issues/584
3641 - name : Pack
3742 run : dotnet pack --output ./artifacts --configuration Release --no-build
38- - uses : actions/upload-artifact@v1
43+ - uses : actions/upload-artifact@v2
3944 with :
4045 name : artifacts
4146 path : ./artifacts
47+ - uses : actions/upload-artifact@v2
48+ with :
49+ name : coverage
50+ path : ./**/TestResults/**/coverage.opencover.xml
4251
4352 publish :
4453 runs-on : ubuntu-latest
4554 needs : build
4655 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
4756 steps :
4857 - name : Checkout
49- uses : actions/checkout@v1
58+ uses : actions/checkout@v2
5059 - name : Setup .NET Core
5160 uses : actions/setup-dotnet@v1
5261 with :
53- dotnet-version : 3.1.300
54- - uses : actions/download-artifact@v1
62+ dotnet-version : 3.1.301
63+ - uses : actions/download-artifact@v2
5564 with :
5665 name : artifacts
5766 path : ./artifacts
0 commit comments