-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines.yml
65 lines (57 loc) · 2.37 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller@0
displayName: 'Use .NET Core sdk 2.2.401'
inputs:
packageType: 'sdk'
version: '2.2.401'
- powershell: |
$installedTools = dotnet tool list --global
if ( ![bool]($installedTools -match "dotnet-sonarscanner"))
{
dotnet tool install --global dotnet-sonarscanner
}
else
{
Write-Host "SonarScanner already installed. Skipping installation."
}
if ( ![bool]($installedTools -match "dotnet-reportgenerator-globaltool"))
{
dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.0.0-rc4
}
else
{
Write-Host "ReportGenerator already installed. Skipping installation."
}
displayName: 'Install Sonar Scanner and ReportGenerator'
- script: |
dotnet restore
dotnet test --logger trx --configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet sonarscanner begin /k:"WouterDeKort_Utopia" /o:"wouterdekort-github" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$(Sonar.Login)" /d:sonar.global.exclusions="wwwroot/lib/**" /d:sonar.branch.name="$(Build.SourceBranchName)" /d:sonar.cs.opencover.reportsPaths="tests\ToDo.Tests\coverage.opencover.xml" /d:sonar.coverage.exclusions="**Tests*.cs""
dotnet build --configuration $(BuildConfiguration)
dotnet sonarscanner end /d:sonar.login="$(Sonar.Login)"
dotnet publish src\ToDo.Web\ToDo.Web.csproj --configuration $(BuildConfiguration) --output ToDo.Web
reportgenerator "-reports:$(Build.SourcesDirectory)\tests\ToDo.Tests\coverage.opencover.xml" "-targetdir:tests\codecoveragereport" "-reporttypes:Cobertura;HTMLInline;HTMLChart"
displayName: 'Build and test'
- task: whitesource.ws-bolt.bolt.wss.WhiteSource Bolt@18
displayName: 'WhiteSource Bolt'
inputs:
cwd: src
advance: true
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
- task: PublishCodeCoverageResults@1
inputs:
summaryFileLocation: $(Build.SourcesDirectory)\tests\codecoveragereport\Cobertura.xml
reportDirectory: $(Build.SourcesDirectory)\tests\codecoveragereport
codecoverageTool: Cobertura
- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact'
inputs:
targetPath: '$(build.artifactstagingdirectory)'
artifact: drop