-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines-sonar.yml
84 lines (70 loc) · 2.17 KB
/
azure-pipelines-sonar.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
variables:
buildConfiguration: "Debug"
testProject: "LuduStack.Tests"
solution: "LuduStack.sln"
strategy:
matrix:
linux:
imageName: 'windows-2022'
trigger:
- development
- master
pr:
- master
pool:
vmImage: $(imageName)
steps:
- task: UseDotNet@2
displayName: 'Set .NET SDK'
inputs:
packageType: 'sdk'
- task: SonarCloudPrepare@1
displayName: 'Prepare Sonar'
inputs:
SonarCloud: '9d5d2c29-7aa7-4f09-abf3-cd9de903d547'
organization: 'anteatergames'
projectKey: 'anteatergames_ludustack'
projectName: 'ludustack'
projectVersion: $(Build.BuildNumber)
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll,**/Migrations/**,**/wwwroot/lib/**,**/wwwroot/thirdparty/**
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/coverage.opencover.xml
- task: DotNetCoreCLI@2
displayName: Restore Packages
inputs:
command: 'restore'
projects: '$(solution)'
- task: DotNetCoreCLI@2
displayName: 'Build $(buildConfiguration)'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: 'Run Tests'
inputs:
command: 'test'
projects: '**/*Tests.csproj'
arguments: '--configuration $(buildConfiguration) --no-restore --no-build --logger trx --collect:"XPlat Code Coverage" --settings coverlet.runsettings'
workingDirectory: '$(Build.SourcesDirectory)'
- task: SonarCloudAnalyze@1
displayName: 'Sonar Cloud Analyze'
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Results'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
- task: DotNetCoreCLI@2
displayName: 'Publish'
inputs:
command: publish
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
projects: $(solution)
publishWebProjects: false
modifyOutputPath: true
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'