-
Notifications
You must be signed in to change notification settings - Fork 297
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
281 lines (259 loc) · 12.5 KB
/
Copy pathazure-pipelines.yml
File metadata and controls
281 lines (259 loc) · 12.5 KB
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
trigger: none
# Branch(es) that trigger(s) build(s) on PR
pr:
branches:
include:
- "*"
paths:
exclude:
- .github/**
- .gitignore
- .devcontainer/*
- docs/*
- .vscode/*
- .markdownlint-cli2.jsonc
- .markdownlintignore
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
- azure-pipelines-official.yml
- azure-pipelines-codeql.yml
- "**/*.xlf"
parameters:
# This option should be used with caution. This is useful for unblocking circular deps issue with testanywhere
- name: SkipTests
displayName: "Skip tests"
type: boolean
default: False
variables:
# Cannot use key:value syntax in root defined variables
- name: _TeamName
value: MSTest
- name: _RunAsInternal
value: False
- name: _RunAsPublic
value: True
stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishTestResults: true
testResultsFormat: 'vstest'
artifacts:
publish:
artifacts: true
logs: true
manifests: true
enableTelemetry: true
jobs:
- job: Windows
timeoutInMinutes: 90
pool:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2026preview.scout.amd64.open
variables:
- template: /eng/pipelines/variables/test-env-vars.yml
strategy:
matrix:
Release:
_BuildConfig: Release
Debug:
_BuildConfig: Debug
steps:
- template: /eng/pipelines/steps/install-windows-prereqs.yml
- task: PowerShell@2
displayName: 'Enable local dumps'
inputs:
targetType: 'inline'
script: |
New-Item -Path $(Build.SourcesDirectory)\artifacts\CrashDumps -ItemType Directory -Force
Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps"
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Value "$(Build.SourcesDirectory)\artifacts\CrashDumps" -PropertyType ExpandString -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpCount" -Value 10 -PropertyType DWord -Force
- script: eng\common\CIBuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
/p:Publish=false
/p:Test=false
/p:FastAcceptanceTest=true
name: Build
displayName: Build
- ${{ if eq(parameters.SkipTests, False) }}:
# Because the build step is using -ci flag, restore is done in a local .packages directory.
# We need to pass NUGET_PACKAGES so that when dotnet test is doing evaluation phase on the projects, it can resolve .props/.targets from packages and import them.
# Otherwise, props/targets are not imported. It's important that they are imported so that IsTestingPlatformApplication ends up being set.
- script: dotnet test -c $(_BuildConfig) --no-build -bl:$(BUILD.SOURCESDIRECTORY)\artifacts\TestResults\$(_BuildConfig)\TestStep.binlog --no-progress --output detailed -p:UsingDotNetTest=true
name: Test
displayName: Test
condition: and(succeeded(), eq(variables._BuildConfig, 'Debug'))
# Integration tests are redundant in Release—they spawn child processes that already cover
# both Debug and Release configurations. Use --test-modules to run only unit tests.
# Use *.exe to cover both net4x (native exe) and net8+/net9+ (apphost exe) in a single glob.
#
# --test-modules bypasses MSBuild evaluation, so test/Directory.Build.targets cannot inject
# any of its TestingPlatformCommandLineArguments. We therefore restore the subset of those
# options that makes sense in Release:
# --report-trx + --report-trx-filename "{asm}_{tfm}.trx" — TRX per (assembly x TFM),
# resolved by Microsoft.Testing.Platform.Services.ArtifactNamingHelper.
# --report-ctrf + --report-ctrf-filename "{asm}_{tfm}.ctrf.json" — CTRF report per
# (assembly x TFM). Same placeholder resolver as TRX. Dogfoods the new CTRF extension
# so any regression in the report shape surfaces on every CI run.
# --report-azdo — surfaces failed tests in the AzDO UI.
# --report-azdo-progress — emits ##vso[task.logdetail ...;progress=...] timeline records so
# long-running test sessions show live progress on the AzDO timeline. No-op outside AzDO
# (gated on TF_BUILD; emits a warning if the option is set but TF_BUILD is not 'true').
# --report-azdo-summary — writes a Markdown job summary and uploads it via ##vso[task.uploadsummary]
# so failure context shows up on the build's summary tab. No-op outside AzDO (gated on TF_BUILD;
# emits a warning if the option is set but TF_BUILD is not 'true').
# --report-junit + --report-junit-filename "{asm}_{tfm}.xml" — JUnit XML per (assembly x TFM),
# resolved by Microsoft.Testing.Platform.Services.ArtifactNamingHelper. Dogfoods the
# Microsoft.Testing.Extensions.JUnitReport extension; the .xml output is published alongside
# the .trx files and can be consumed by AzDO PublishTestResults@2 (testResultsFormat: 'JUnit'),
# Jenkins, GitLab, GitHub Actions test reporters, etc.
# --hangdump --hangdump-timeout 15m — captures a dump if a module hangs past 15 minutes.
# --diagnostic + --diagnostic-verbosity trace — produces per-host diagnostic logs;
# directory is published by the Arcade jobs.yml template (artifacts.publish.logs: true).
# We intentionally do NOT pass:
# --crashdump — gated on .NETCoreApp in Directory.Build.targets; the CrashDump extension's
# ValidateTestHostEnvironmentVariablesAsync hard-fails the run on non-NETCoreApp hosts
# (see src/Platform/Microsoft.Testing.Extensions.CrashDump/CrashDumpEnvironmentVariableProvider.cs),
# and this glob mixes net4x and net8+/net9+ hosts.
# --coverage — coverage upload is Debug-only (see "Merge coverage" / "Publish coverage to
# Azure DevOps" steps below), so collecting coverage in Release would just write unused
# .coverage files.
- script: dotnet test --no-build --test-modules "artifacts/bin/*UnitTests*/$(_BuildConfig)/**/*UnitTests.exe" --results-directory $(BUILD.SOURCESDIRECTORY)\artifacts\TestResults\$(_BuildConfig) --no-progress --output detailed --report-trx --report-trx-filename "{asm}_{tfm}.trx" --report-ctrf --report-ctrf-filename "{asm}_{tfm}.ctrf.json" --report-azdo --report-azdo-progress --report-azdo-summary --report-junit --report-junit-filename "{asm}_{tfm}.xml" --hangdump --hangdump-timeout 15m --diagnostic --diagnostic-output-directory $(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig) --diagnostic-verbosity trace
name: TestRelease
displayName: Test (unit tests only)
condition: and(succeeded(), eq(variables._BuildConfig, 'Release'))
- task: PublishBuildArtifacts@1
displayName: 'Publish Test Results folders'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
ArtifactName: TestResults_Windows_$(_BuildConfig)_Attempt$(System.JobAttempt)
condition: always()
- task: CopyFiles@2
displayName: 'Copy binlogs'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/artifacts/tmp/$(_BuildConfig)/testsuite'
Contents: |
**/*.binlog
TargetFolder: '$(Build.ArtifactStagingDirectory)/binlogs'
condition: and(always(), eq(variables._BuildConfig, 'Debug'))
- task: PublishBuildArtifacts@1
displayName: 'Publish integration tests binlogs'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/binlogs'
ArtifactName: Integration_Tests_Windows_Binlogs_$(_BuildConfig)
condition: and(always(), eq(variables._BuildConfig, 'Debug'))
# Publish coverage to Azure DevOps. PublishCodeCoverageResults@2 accepts the binary
# .coverage format Microsoft Code Coverage emits natively (per
# https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/publish-code-coverage-results-v2:
# "The task supports all kinds of coverage formats such as: .coverage, .covx, .covb,
# .cjson, .xml, .lcov, pycov, etc."), and merges multiple files via the minimatch glob.
# Coverage shows up in the build's "Code Coverage" tab and on the build summary, one
# click from the GitHub PR status check (we used to upload to codecov.io here).
- task: PublishCodeCoverageResults@2
displayName: 'Publish coverage to Azure DevOps'
inputs:
summaryFileLocation: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/*.coverage'
pathToSources: '$(Build.SourcesDirectory)/src'
condition: and(succeededOrFailed(), eq(variables._BuildConfig, 'Debug'))
- task: PublishBuildArtifacts@1
displayName: 'Publish local dumps'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/CrashDumps'
ArtifactName: TestResults_Windows_$(_BuildConfig)
condition: failed()
- job: Linux
timeoutInMinutes: 90
pool:
name: NetCore-Public
demands: ImageOverride -equals build.ubuntu.2204.amd64.open
variables:
- template: /eng/pipelines/variables/test-env-vars.yml
strategy:
matrix:
Release:
_BuildConfig: Release
Debug:
_BuildConfig: Debug
steps:
- script: eng/common/cibuild.sh
-configuration $(_BuildConfig)
-prepareMachine
/p:Test=false
/p:Publish=false
/p:NonWindowsBuild=true
/p:FastAcceptanceTest=true
displayName: Build
- ${{ if eq(parameters.SkipTests, False) }}:
- template: /eng/pipelines/steps/test-non-windows.yml
parameters:
osName: Linux
- job: MacOS
timeoutInMinutes: 90
pool:
name: Azure Pipelines
vmImage: macos-latest
os: macOS
variables:
- template: /eng/pipelines/variables/test-env-vars.yml
strategy:
matrix:
Release:
_BuildConfig: Release
Debug:
_BuildConfig: Debug
steps:
- script: eng/common/cibuild.sh
-configuration $(_BuildConfig)
-prepareMachine
/p:Test=false
/p:Publish=false
/p:NonWindowsBuild=true
/p:FastAcceptanceTest=true
displayName: Build
- ${{ if eq(parameters.SkipTests, False) }}:
- template: /eng/pipelines/steps/test-non-windows.yml
parameters:
osName: MacOS
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
artifacts:
publish:
logs:
name: 'Logs_Build_$(Agent.JobName)_$(_BuildConfig)'
manifests: true
enableTelemetry: true
jobs:
- job: WindowsSamples
timeoutInMinutes: 30
pool:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2026preview.scout.amd64.open
strategy:
matrix:
Release:
_BuildConfig: Release
Debug:
_BuildConfig: Debug
steps:
- task: PowerShell@2
displayName: 'Install Windows SDK'
inputs:
targetType: filePath
filePath: './eng/install-windows-sdk.ps1'
failOnStderr: true
showWarnings: true
- task: PowerShell@2
displayName: 'Build Samples'
inputs:
targetType: filePath
filePath: './eng/build-samples.ps1'
arguments: '-Configuration $(_BuildConfig) -TreatWarningsAsErrors -BinaryLogDirectory "$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)"'
failOnStderr: false