forked from microsoft/vstest
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
335 lines (306 loc) · 11.9 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# Branches that trigger a build on commit
trigger:
branches:
include:
- main
- rel/*
exclude:
- rel/15.*
- rel/16.*
- rel/17.0
- rel/17.1
- rel/17.2
- rel/17.3
- rel/17.4
- rel/17.5
- rel/17.6
# Branch(es) that trigger(s) build(s) on PR
pr:
branches:
include:
- main
- rel/*
paths:
exclude:
- .github/*
- .devcontainer/*
- docs/*
- .markdownlint.json
- .markdownlintignore
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
parameters:
- name: isRTM
displayName: "Produce RTM version?"
type: boolean
default: False
- name: SDLEnabled
displayName: "Run SDL validation"
type: boolean
default: False
variables:
# Cannot use key:value syntax in root defined variables
- name: _TeamName
value: TestPlatformTeam
- name: Codeql.Enabled
value: true
- name: _RunAsInternal
value: ${{ and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}
- name: _RunAsPublic
value: ${{ eq(variables._RunAsInternal, False) }}
# Set default value for variables of PR and Public builds
- name: _SignType
value: test
- name: _SignArgs
value: ''
- name: _Sign
value: False
- name: _InternalBuildArgs
value: ' '
- name: _ReleaseVersionKind
value: ''
# Arcade is using global cache of nugets in non-windows build
# under some circumstances, but we don't respect that in our code and try to find them
# in .packages. Force the location of packages to that folder.
- name: NUGET_PACKAGES
value: '$(Build.SourcesDirectory)/.packages/'
- ${{ if eq(parameters.isRTM, True) }}:
- name: _ReleaseVersionKind
value: release
# Produce real signed binaries for Internal builds
- ${{ if eq(variables._RunAsInternal, True) }}:
# Group gives access to $microsoft-symbol-server-pat and $symweb-symbol-server-pat
- group: DotNet-Symbol-Server-Pats
# Group gives access to $dn-bot-devdiv-drop-rw-code-rw and dn-bot-dnceng-build-rw-code-rw
- group: DotNet-VSTS-Infra-Access
- name: _DevDivDropAccessToken
value: $(dn-bot-devdiv-drop-rw-code-rw)
- name: _SignType
value: real
- name: _SignArgs
value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) /p:Sign=$(_Sign)
- name: _Sign
value: True
- name: VisualStudioDropName
value: Products/$(System.TeamProject)/$(Build.DefinitionName)/$(Build.SourceBranchName)/$(Build.BuildNumber)
- name: _InternalBuildArgs
# IncludeSourceRevisionInInformationalVersion prevents ProductVersion (on file), and AssemblyInformationalVersion
# from appending +<commitId>, which breaks DTAAgent.
value: /p:DotNetSignType=$(_SignType)
/p:TeamName=$(_TeamName)
/p:DotNetFinalVersionKind=$(_ReleaseVersionKind)
/p:DotNetPublishUsingPipelines=true
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
/p:VisualStudioDropName=$(VisualStudioDropName)
/p:GenerateSbom=true
/p:IncludeSourceRevisionInInformationalVersion=false
stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
enablePublishTestResults: true
testResultsFormat: 'vstest'
enableTelemetry: true
enableSourceBuild: true
jobs:
- job: Windows
timeoutInMinutes: 120
pool:
${{ if eq(variables._RunAsPublic, True) }}:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2022.amd64.open
${{ if eq(variables._RunAsInternal, True) }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals 1es-windows-2022
strategy:
matrix:
Release:
_BuildConfig: Release
# ${{ if eq(variables._RunAsPublic, True) }}:
# Debug:
# _BuildConfig: Debug
steps:
# This steps help to understand versions of .NET runtime installed on the machine,
# which is useful to diagnose some governance issues.
- task: DotNetCoreCLI@2
displayName: 'dotnet --info'
inputs:
command: custom
custom: '--info'
# Restore internal tools required for SBOM generation
- ${{ if eq(variables._RunAsInternal, True) }}:
- template: /eng/restore-internal-tools.yml
- powershell: eng\common\CIBuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
$(_InternalBuildArgs)
/p:Test=false
/p:SourceBranchName=$(Build.SourceBranchName)
name: Build
displayName: Build
# -ci is allowing to import some environment variables and some required configurations
# -nobl avoid overwriting binlog of the main Build
- script: Test.cmd
-configuration $(_BuildConfig)
-ci
-nobl
-integrationTest
-performanceTest
name: Test
displayName: Test
# This step is only helpful for diagnosing some issues with vstest/test host that would not appear
# through the console or trx
- task: PublishBuildArtifacts@1
displayName: 'Publish Test Results folders'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
ArtifactName: TestResults
condition: failed()
# Public pipeline does not upload packages into artifacts, but we need them for tests on Linux and MacOS.
- ${{ if eq(variables._RunAsPublic, True) }}:
- task: PublishBuildArtifacts@1
displayName: 'Publish Shipping Packages'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/Shipping'
ArtifactName: PackageArtifacts
- task: PublishBuildArtifacts@1
displayName: 'Publish NonShippping Packages'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/NonShipping'
ArtifactName: PackageArtifacts
- task: PublishBuildArtifacts@1
displayName: 'Publish VSSetup'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/VSSetup/$(_BuildConfig)'
ArtifactName: VSSetupArtifacts
- job: OtherOSes
dependsOn: Windows
workspace:
clean: all
variables:
# Publish Logs seems to depend on this name of variable, so we define it
# even when we don't use matrix.
- name: _BuildConfig
value: Release
strategy:
matrix:
Ubuntu_22_04:
vmImage: ubuntu-22.04
pwsh: true
macOS_11:
vmImage: macOS-11
pwsh: true
pool:
vmImage: $[ variables['vmImage'] ]
steps:
- checkout: self
fetchDepth: 1
clean: true
# Build but don't pack, packing does not work on non-windows and we want to test what we built on Windows
# anyway. Because that is what we will publish.
- script: ./build.sh
--configuration $(_BuildConfig)
--ci
name: Build
displayName: Build
# Download the built packages into local package source, as if we built them on this machine.
- task: DownloadPipelineArtifact@2
displayName: Download Package Artifacts
inputs:
artifactName: PackageArtifacts
targetPath: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/Shipping'
- script: ./test.sh
--configuration $(_BuildConfig)
--ci
--integrationTest
--performanceTest
name: Test
displayName: Test
# This step is only helpful for diagnosing some issues with vstest/test host that would not appear
# through the console or trx
- task: PublishBuildArtifacts@1
displayName: 'Publish Test Results folders'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
ArtifactName: TestResults
condition: failed()
- ${{ if eq(variables._RunAsInternal, True) }}:
- job: Publish
dependsOn: OtherOSes
pool:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals 1es-windows-2022
strategy:
matrix:
Release:
_BuildConfig: Release
steps:
# The template job needs a log, otherwise it writes a warning. We can disable log uploading only for
# the whole stage, which is not what we want to do. So we write an empty file instead.
- pwsh: 'New-Item -Type file -Force "$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/empty.log"'
name: 'Add_empty_logfile'
# Download the built packages into local package source, as if we built them on this machine.
- task: DownloadPipelineArtifact@2
displayName: Download Package Artifacts
inputs:
artifactName: PackageArtifacts
targetPath: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/Shipping'
- task: DownloadPipelineArtifact@2
displayName: Download VSSetup Artifacts
inputs:
artifactName: VSSetupArtifacts
targetPath: '$(Build.SourcesDirectory)/artifacts/VSSetup/$(_BuildConfig)'
- task: NuGetAuthenticate@0
displayName: 'NuGet Authenticate to dotnet-tools and test-tools feeds'
- task: NuGetCommand@2
displayName: 'Publish NuGet packages to dotnet-tools feed'
inputs:
command: push
packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
publishVstsFeed: 'public/dotnet-tools'
- task: NuGetCommand@2
displayName: 'Publish NuGet packages to test-tools feed'
inputs:
command: push
packagesToPush: 'artifacts/packages/$(_BuildConfig)/**/*.nupkg;!artifacts/packages/$(_BuildConfig)/**/*.symbols.nupkg'
publishVstsFeed: 'public/test-tools'
# Publishes setup VSIXes to a drop.
# Note: The insertion tool looks for the display name of this task in the logs.
- task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1
displayName: Upload VSTS Drop
inputs:
DropName: $(VisualStudioDropName)
DropFolder: 'artifacts\VSSetup\$(_BuildConfig)\Insertion'
AccessToken: $(_DevDivDropAccessToken)
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: Publish Artifact VSSetup
inputs:
PathtoPublish: 'artifacts\VSSetup\$(_BuildConfig)'
ArtifactName: 'VSSetup'
condition: succeeded()
- ${{ if eq(variables._RunAsInternal, True) }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
GitHubOrg: microsoft
MirrorRepo: vstest
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-VSTEST'
- ${{ if eq(variables._RunAsInternal, True) }}:
- template: eng\common\templates\post-build\post-build.yml
parameters:
publishingInfraVersion: 3
SDLValidationParameters:
enable: false
continueOnError: false
params: ' -SourceToolsList @("policheck","credscan")'