@@ -14,42 +14,53 @@ jobs:
14
14
echo "BuildId = $(buildId)"
15
15
displayName: 'Print buildId'
16
16
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'
20
22
21
23
- task : PowerShell@2
22
- displayName : " Use JDK17 by default"
24
+ displayName : " Use JDK11 by default"
23
25
inputs :
24
26
targetType : ' inline'
25
27
script : |
26
- $jdkPath = $env:JAVA_HOME_17_X64
28
+ $jdkPath = $env:JAVA_HOME_11_X64
27
29
Write-Host "##vso[task.setvariable variable=JAVA_HOME]$jdkPath"
28
30
29
31
- script : |
30
32
dotnet dev-certs https --trust || true
31
33
displayName: 'dotnet dev-certs https'
32
34
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'
36
37
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
37
45
38
46
- task : DotNetCoreCLI@2
39
47
displayName : ' Build Unit tests'
40
48
inputs :
41
49
command : ' build'
42
50
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'
44
52
45
53
- task : CmdLine@2
46
54
inputs :
47
55
script : ' dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net8.0'
48
56
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
49
61
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'
53
64
condition : and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
54
65
55
66
- task : whitesource.ws-bolt.bolt.wss.WhiteSource Bolt@19
0 commit comments