@@ -14,42 +14,53 @@ jobs:
1414 echo "BuildId = $(buildId)"
1515 displayName: 'Print buildId'
1616
17- - script : |
18- dotnet tool install --global dotnet-sonarscanner
19- displayName: 'Install SonarScanner tool'
17+ - task : UseDotNet@2
18+ displayName : Use .NET 8.0
19+ inputs :
20+ packageType : ' sdk'
21+ version : ' 8.0.x'
2022
2123 - task : PowerShell@2
22- displayName : " Use JDK17 by default"
24+ displayName : " Use JDK11 by default"
2325 inputs :
2426 targetType : ' inline'
2527 script : |
26- $jdkPath = $env:JAVA_HOME_17_X64
28+ $jdkPath = $env:JAVA_HOME_11_X64
2729 Write-Host "##vso[task.setvariable variable=JAVA_HOME]$jdkPath"
2830
2931 - script : |
3032 dotnet dev-certs https --trust || true
3133 displayName: 'dotnet dev-certs https'
3234
33- - script : |
34- dotnet sonarscanner begin /k:"WireMock-Net_WireMock.Net" /o:"wiremock-net" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="$(SONAR_TOKEN)" /d:sonar.dotnet.excludeTestProjects=true /d:sonar.cs.opencover.reportsPaths=**/coverage.net8.0.opencover.xml /d:sonar.verbose=true
35- displayName: 'Begin analysis on SonarCloud'
35+ - task : SonarCloudPrepare@1
36+ displayName : ' Prepare analysis on SonarCloud'
3637 condition : and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
38+ inputs :
39+ SonarCloud : SonarCloud
40+ organization : wiremock-net
41+ projectKey : ' WireMock-Net_WireMock.Net'
42+ projectName : ' WireMock.Net'
43+ extraProperties : |
44+ sonar.cs.opencover.reportsPaths=**/coverage.net8.0.opencover.xml
3745
3846 - task : DotNetCoreCLI@2
3947 displayName : ' Build Unit tests'
4048 inputs :
4149 command : ' build'
4250 projects : ' ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
43- arguments : ' --configuration Debug --framework net8.0 --no-incremental '
51+ arguments : ' --configuration Debug --framework net8.0'
4452
4553 - task : CmdLine@2
4654 inputs :
4755 script : ' dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net8.0'
4856 displayName : ' Execute Unit Tests with Coverage'
57+
58+ - task : SonarCloudAnalyze@1
59+ displayName : ' SonarCloud: Run Code Analysis'
60+ condition : and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
4961
50- - script : |
51- dotnet sonarscanner end /d:sonar.token="$(SONAR_TOKEN)"
52- displayName: 'End analysis on SonarCloud'
62+ - task : SonarCloudPublish@1
63+ displayName : ' SonarCloud: Publish Quality Gate Result'
5364 condition : and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
5465
5566 - task : whitesource.ws-bolt.bolt.wss.WhiteSource Bolt@19
0 commit comments