-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsonarcloud-pipeline.yml
103 lines (88 loc) · 3.03 KB
/
sonarcloud-pipeline.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# SonarCloud pipeline for the PacMan.
trigger: none
schedules:
- cron: "0 0,6,9,12,15,18,21 * * *"
displayName: Scheduled SonarCloud Build
branches:
include:
- master
pool:
vmImage: 'windows-2019'
variables:
solution: '$(Build.SourcesDirectory)/PacMan.sln'
buildPlatform: 'x86'
buildConfiguration: 'Debug'
buildWrapperOutputDir: '$(Build.SourcesDirectory)/build_wrapper_output_directory'
buildWrapperExe: '$(Build.SourcesDirectory)/tools/build-wrapper-win-x86-64.exe'
msBuildExe: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe'
coverageDownloadLocation: '$(Build.SourcesDirectory)\DownloadedCoverage'
coverageOutputLocation: '$(Build.SourcesDirectory)\TestResults'
toolsLocation: '$(Build.SourcesDirectory)\tools'
coverageFiles: '$(coverageOutputLocation)\*.xml'
steps:
- task: UsePythonVersion@0
displayName: Set up python version.
inputs:
versionSpec: '3.x'
addToPath: true
architecture: 'x64'
- task: CmdLine@2
displayName: Coverage - Create .coverage output directory.
inputs:
script: 'mkdir $(coverageOutputLocation)'
- task: DownloadPipelineArtifact@2
displayName: Coverage - Download .coverage artifacts
inputs:
buildType: 'specific'
project: '41987b1d-47e2-4fea-90ac-c2b42d11a558'
definition: '1'
specificBuildWithTriggering: true
buildVersionToDownload: 'latest'
artifactName: 'coverage'
itemPattern: '**/*.coverage'
targetPath: '$(coverageDownloadLocation)'
- task: PythonScript@0
displayName: Coverage - Convert .coverage files to .xml
inputs:
scriptSource: 'filePath'
scriptPath: '$(toolsLocation)/convert_coverage.py'
arguments: '$(coverageDownloadLocation)'
workingDirectory: '$(coverageOutputLocation)'
- task: PublishPipelineArtifact@0
displayName: Coverage - Publish .xml files
inputs:
artifactName: 'convertedCoverage'
targetPath: '$(coverageOutputLocation)'
- script: |
vcpkg install sdl2 sdl2-image gtest
vcpkg integrate install
displayName: vcpkg
- task: NuGetToolInstaller@0
displayName: 'Nuget - Install'
- task: NuGetCommand@2
displayName: 'Nuget - Restore Packages'
inputs:
restoreSolution: '$(solution)'
- task: SonarCloudPrepare@1
displayName: 'SonarCloud - Prepare'
inputs:
SonarCloud: 'PacManSonarCloud'
organization: 'beardedplatypus'
scannerMode: 'MSBuild'
projectKey: 'BeardedPlatypus_PacMan'
projectName: 'PacMan'
extraProperties: |
sonar.cfamily.build-wrapper-output=$(buildWrapperOutputDir)
sonar.cfamily.vscoveragexml.reportsPath=$(coverageFiles)
sonar.cfamily.cache.enabled=false
- task: PowerShell@2
displayName: MSBuild
inputs:
targetType: 'inline'
script: '& $(buildWrapperExe) --out-dir $(buildWrapperOutputDir) "$(msBuildExe)" $(solution) -nologo -p:Configuration=$(buildConfiguration) -p:Platform=$(buildPlatform)'
- task: SonarCloudAnalyze@1
displayName: 'SonarCloud - Analyze'
- task: SonarCloudPublish@1
displayName: 'SonarCloud - Publish'
inputs:
pollingTimeoutSec: '300'