-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
211 lines (193 loc) · 6.13 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
variables:
- template: eng/common-variables.yml
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- name: POWERSHELL_TELEMETRY_OPTOUT
value: 1
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: 1
- name: DOTNET_NOLOGO
value: true
- name: Configuration
value: 'Debug'
- name: SolutionPath
value: 'SampleSolution.sln'
- name: DOTNET_ROLL_FORWARD
value: 'Major'
# Only run against main
trigger:
branches:
include:
- main
paths:
exclude:
- '**/*.md'
stages:
- stage: build_Azure_DevOps
displayName: Build (Azure DevOps tasks)
jobs:
- job: 'build_and_test'
displayName: 'Build and Test'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '$(SolutionPath)'
feedsToUse: config
nugetConfigPath: NuGet.Config
noCache: true
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
configuration: '$(Configuration)'
projects: '$(SolutionPath)'
arguments: '--no-restore'
- task: DotNetCoreCLI@2
displayName: 'dotnet unit test'
inputs:
command: test
configuration: $(Configuration)
projects: |
**/*.Tests.csproj
arguments: '--no-restore --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura'
workingDirectory: '$(Build.SourcesDirectory)'
publishTestResults: false
- task: PublishBuildArtifacts@1
enabled: false
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
- stage: build_ArcadeLight
displayName: Build (ArcadeLight)
dependsOn: []
jobs:
- template: /eng/azuredevops/pipelines/jobs/jobs.yml
parameters:
artifacts:
publish:
artifacts: true
logs: true
workspace:
clean: all
jobs:
- job: 'arcade_light_build'
displayName: 'Build and Test (ArcadeLight)'
pool:
vmImage: 'windows-latest'
strategy:
matrix:
Build_Release:
_BuildConfig: Release
Build_Debug:
_BuildConfig: Debug
preSteps:
- checkout: self
fetchDepth: 0
clean: true
steps:
- task: NuGetAuthenticate@1
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
useGlobalJson: true
- script: eng\commonlight\cibuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
$(_InternalBuildArgs)
/p:Test=false
displayName: Windows Build / Publish
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
# vstest with coverlet.collector requires 'publish' of test project to generate coverage data
- task: DotNetCoreCLI@2
displayName: Publish test project
inputs:
command: 'publish'
arguments: '-f net8.0 --configuration $(_BuildConfig)'
publishWebProjects: false
projects: 'src/**/*Tests.csproj'
zipAfterPublish: false
modifyOutputPath: false
enabled: false
- powershell: eng\commonlight\build.ps1
-configuration $(_BuildConfig)
-ci
-restore
-test
-projects $(Build.SourcesDirectory)\**\*Tests.csproj
/bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\test-windows.binlog
/p:RestoreUsingNuGetTargets=false
displayName: Run Tests
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: VSTest
testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/**/*.trx'
- template: ../steps/CoverageResults.yml
parameters:
reports: $(Build.SourcesDirectory)/**/coverage.cobertura.xml
condition: and(succeeded(), eq(variables['_BuildConfig'], 'Debug'))
assemblyfilters: '-xunit'
breakBuild: false
- task: CopyFiles@2
displayName: Copy log files
condition: always()
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**/*.log
**/*.binlog
TargetFolder: '$(Build.SourcesDirectory)/artifacts/logs'
- publish: '$(Build.SourcesDirectory)/artifacts/TestResults'
displayName: 'Publish TestResults Artifacts'
artifact: TestResults_$(Agent.Os)_$(_BuildConfig)
condition: succeededOrFailed()
- stage: Validate
displayName: Validate
dependsOn: build_Azure_DevOps
jobs:
- job: 'Static_Code_Analysis'
displayName: 'Static code analysis'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Use dotnet SDK (global)'
inputs:
packageType: 'sdk'
useGlobalJson: true
- task: NuGetAuthenticate@1
displayName: "Authenticate on nuget feeds"
- task: DotNetCoreCLI@2
displayName: "Restore dotnet Projects"
inputs:
command: restore
projects: '$(SolutionPath)'
feedsToUse: config
nugetConfigPath: 'nuget.config'
- template: eng/azuredevops/pipelines/steps/CheckNugetStatus.yml
parameters:
sourcePath: '$(Build.SourcesDirectory)/src'
nugetConfig: '$(Build.SourcesDirectory)/nuget.config'
breakBuild: true
- template: eng/azuredevops/pipelines/steps/GenerateSBOM.yml
parameters:
projects: '$(SolutionPath)'
outputPath: '$(Build.SourcesDirectory)\artifacts'
publishSBOM: true