-
Notifications
You must be signed in to change notification settings - Fork 577
Expand file tree
/
Copy pathazure-pipelines.yaml
More file actions
482 lines (432 loc) · 21.5 KB
/
Copy pathazure-pipelines.yaml
File metadata and controls
482 lines (432 loc) · 21.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
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# .NET for Android Pipeline
name: $(Build.SourceBranchName)-$(Build.SourceVersion)-$(Rev:r)
trigger:
- main
- d16-*
- d17-*
- release/*
- feature/*
pr: none
# External sources, scripts, tests, and yaml template files.
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
- repository: yaml-templates
type: git
name: DevDiv/Xamarin.yaml-templates
ref: refs/heads/main
- repository: maui
type: github
name: dotnet/maui
ref: net11.0
endpoint: xamarin
parameters:
- name: pushXAPackagesToMaestro
default: true
- name: macTestAgentsUseCleanImages # Test agents we do not need to clean up when finished because they are not reused
default: true
- name: Skip1ESComplianceTasks
default: false
# Global variables
variables:
- template: /build-tools/automation/yaml-templates/variables.yaml@self
- ${{ if eq(variables['Build.DefinitionName'], 'Xamarin.Android-Private') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
- group: DotNet-MSRC-Storage
- name: DotNetFeedCredential
value: dotnet8-internal-dnceng-internal-feed
- ${{ if ne(variables['Build.DefinitionName'], 'Xamarin.Android-Private') }}:
- name: DotNetFeedCredential
value: dnceng-dotnet9
extends:
${{ if eq(variables['Build.DefinitionName'], 'Xamarin.Android') }}:
template: azure-pipelines/MicroBuild.1ES.Official.yml@1esPipelines
${{ else }}:
template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@1esPipelines
parameters:
sdl:
${{ if eq('${{ parameters.Skip1ESComplianceTasks }}', 'true') }}:
enableAllTools: false
binskim:
scanOutputDirectoryOnly: true
codeql:
compiled:
enabled: false
justificationForDisabling: CodeQL runs against the nightly build
policheck:
enabled: false
justification: Built in task does not support multi-language scanning
spotBugs:
enabled: false
justification: 'Failing with "Could not successfully find the java tool launcher"'
sourceAnalysisPool:
name: AzurePipelines-EO
image: $(WindowsPoolImage1ESPT)
os: windows
sourceRepositoriesToScan:
exclude:
- repository: yaml-templates
- repository: maui
suppression:
suppressionFile: $(Build.SourcesDirectory)\.gdn\.gdnsuppress
settings:
skipBuildTagsForGitHubPullRequests: true
stages:
- template: /build-tools/automation/yaml-templates/build-macos.yaml@self
- template: /build-tools/automation/yaml-templates/build-windows.yaml@self
- template: /build-tools/automation/yaml-templates/build-linux.yaml@self
- template: /build-tools/automation/yaml-templates/stage-package-tests.yaml@self
parameters:
macTestAgentsUseCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}
- template: /build-tools/automation/yaml-templates/stage-linux-tests.yaml@self
- template: /build-tools/automation/yaml-templates/stage-msbuild-tests.yaml@self
- template: /build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml@self
parameters:
usesCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}
- template: /build-tools/automation/yaml-templates/stage-java-interop-tests.yaml@self
parameters:
# The internal Xamarin.Android pipeline uses 1ES Pipeline Templates, which
# require Windows jobs to run on a 1ES-hosted pool. macOS is fine on the
# hosted Azure Pipelines pool as long as `os: macOS` is set (which is now
# the template default).
windowsPool:
name: MAUI-1ESPT
image: $(WindowsPoolImage1ESPT)
os: windows
- stage: maui_tests
displayName: MAUI Tests
dependsOn: mac_build
condition: and(in(dependencies.mac_build.result, 'Succeeded', 'SucceededWithIssues'), eq(variables['RunMAUITestJob'], 'true'))
jobs:
# Check - "Xamarin.Android (MAUI Tests MAUI Integration)"
- job: maui_tests_integration
displayName: MAUI Integration
pool:
name: MAUI-1ESPT
image: $(WindowsPoolImage1ESPT)
os: windows
timeoutInMinutes: 180
workspace:
clean: all
variables:
BuildVersion: $(Build.BuildId)
# Ignore MAUI's public API analyzer errors (RS0016) - dotnet/android does not care about those
PublicApiType: Generate
steps:
- checkout: maui
clean: true
submodules: recursive
path: s/maui
persistCredentials: true
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml@self
parameters:
xaSourcePath: $(Build.SourcesDirectory)/android
androidSdkPlatforms: $(DefaultTestSdkPlatforms)
dotnetVersion: $(DotNetSdkVersion)
dotnetQuality: $(DotNetSdkQuality)
- task: NuGetAuthenticate@1
displayName: authenticate with azure artifacts
inputs:
forceReinstallCredentialProvider: true
- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: $(Build.StagingDirectory)/android-packs
- pwsh: |
$searchPath = Join-Path $(Build.StagingDirectory) android-packs
$wlmanPack = Get-ChildItem $searchPath -Filter *Android*Manifest*.nupkg | Select-Object -First 1
$dest = Join-Path $searchPath "tmp-wlman" "$($wlmanPack.BaseName)"
Expand-Archive -LiteralPath $wlmanPack -DestinationPath $dest
$wlmanJsonPath = Join-Path $dest "data" "WorkloadManifest.json"
$json = Get-Content $wlmanJsonPath | ConvertFrom-Json -AsHashtable
Write-Host "Setting variable ANDROID_PACK_VERSION = $($json["version"])"
Write-Host "##vso[task.setvariable variable=ANDROID_PACK_VERSION;]$($json["version"])"
displayName: Set ANDROID_PACK_VERSION
- pwsh: >-
$(Build.SourcesDirectory)/maui/eng/scripts/update-version-props.ps1
-xmlFileName "$(Build.SourcesDirectory)/maui/eng/Versions.props"
-androidVersion $(ANDROID_PACK_VERSION)
displayName: Update MAUI's Android dependency
- task: DotNetCoreCLI@2
displayName: Update Android SDK band in Workloads.csproj
inputs:
projects: $(Build.SourcesDirectory)/android/Xamarin.Android.sln
arguments: -t:UpdateMauiWorkloadsProj -c $(XA.Build.Configuration) --no-restore -v:n -bl:$(Build.StagingDirectory)/logs/update-maui-workloadsproj.binlog
- pwsh: ./build.ps1 --target=dotnet --configuration="$(XA.Build.Configuration)" --nugetsource="$(Build.StagingDirectory)\android-packs" --verbosity=diagnostic
displayName: Install .NET
retryCountOnTaskFailure: 3
workingDirectory: $(Build.SourcesDirectory)/maui
- pwsh: ./build.ps1 --target=dotnet-pack --configuration="$(XA.Build.Configuration)" --nugetsource="$(Build.StagingDirectory)\android-packs" --verbosity=diagnostic
displayName: Pack .NET Maui
workingDirectory: $(Build.SourcesDirectory)/maui
- task: DotNetCoreCLI@2
displayName: Install MAUI workload packs
retryCountOnTaskFailure: 3
inputs:
projects: $(Build.SourcesDirectory)/android/Xamarin.Android.sln
arguments: -t:InstallMaui -p:MauiUseLocalPacks=true -p:MauiWorkloadToInstall=maui -p:MauiManifestDiagnosticsPath=$(Build.StagingDirectory)/logs/maui-manifest -c $(XA.Build.Configuration) --no-restore -v:n -bl:$(Build.StagingDirectory)/logs/install-maui.binlog
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
parameters:
command: new
arguments: maui -o $(Build.StagingDirectory)/MauiTestProj
xaSourcePath: $(Build.SourcesDirectory)/android
displayName: Create MAUI template
continueOnError: false
- template: /build-tools/automation/yaml-templates/set-maui-target-framework-android.yaml@self
parameters:
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
parameters:
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj
arguments: >-
-f $(DotNetTargetFramework)-android -c Debug
--configfile $(Build.SourcesDirectory)/maui/NuGet.config
-bl:$(Build.StagingDirectory)/logs/MauiTestProj-Debug.binlog
xaSourcePath: $(Build.SourcesDirectory)/android
displayName: Build MAUI template - Debug
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
parameters:
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj
arguments: >-
-f $(DotNetTargetFramework)-android -c Release
--configfile $(Build.SourcesDirectory)/maui/NuGet.config
-bl:$(Build.StagingDirectory)/logs/MauiTestProj-Release.binlog
xaSourcePath: $(Build.SourcesDirectory)/android
displayName: Build MAUI template - Release
- template: /build-tools/automation/yaml-templates/run-maui-r2r-helix-matrix.yaml@self
parameters:
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj
xaSourcePath: $(Build.SourcesDirectory)/android
logsDirectory: $(Build.StagingDirectory)/logs
extraBuildArguments: --configfile $(Build.SourcesDirectory)/maui/NuGet.config
- task: CopyFiles@2
displayName: copy build logs
condition: always()
inputs:
Contents: |
$(Build.SourcesDirectory)/android/bin/*$(XA.Build.Configuration)/*.*log
$(Build.SourcesDirectory)/maui/artifacts/logs/**
TargetFolder: $(Build.StagingDirectory)/logs
flattenFolders: true
- template: /build-tools/automation/yaml-templates/publish-artifact.yaml@self
parameters:
displayName: upload build and test results
artifactName: Test Results - MAUI Integration
targetPath: $(Build.StagingDirectory)/logs
condition: or(ne(variables['Agent.JobStatus'], 'Succeeded'), eq(variables['XA.PublishAllLogs'], 'true'))
- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml@self
- stage: dotnet_prepare_release
displayName: Prepare .NET Release
dependsOn:
- mac_build
- linux_build
condition: and(in(dependencies.mac_build.result, 'Succeeded', 'SucceededWithIssues'), in(dependencies.linux_build.result, 'Succeeded', 'SucceededWithIssues'), eq(variables['Build.DefinitionName'], 'Xamarin.Android'))
jobs:
# Check - "Xamarin.Android (Prepare .NET Release Sign Archives)"
- template: sign-artifacts/jobs/v4.yml@yaml-templates
parameters:
name: sign_net_mac_win
poolName: $(VSEngMicroBuildPool)
artifactName: $(NuGetArtifactName)
${{ if and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.DefinitionName'], 'Xamarin.Android')) }}:
signType: Real
${{ else }}:
signType: Test
signedArtifactName: nuget-signed
usePipelineArtifactTasks: true
uploadPrefix: sign-mac-win
handleUnmappedFiles: fail
timeoutInMinutes: 240
# Check - "Xamarin.Android (Prepare .NET Release Sign Linux Archive)"
- template: sign-artifacts/jobs/v4.yml@yaml-templates
parameters:
name: sign_net_linux
displayName: Sign Linux Archive
poolName: $(VSEngMicroBuildPool)
artifactName: $(LinuxNuGetArtifactName)
${{ if and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.DefinitionName'], 'Xamarin.Android')) }}:
signType: Real
${{ else }}:
signType: Test
signedArtifactName: nuget-linux-signed
usePipelineArtifactTasks: true
uploadPrefix: sign-linux
handleUnmappedFiles: fail
timeoutInMinutes: 120
# Check - "Xamarin.Android (Prepare .NET Release Convert NuGet to MSI)"
- template: nuget-msi-convert/job/v5.yml@yaml-templates
parameters:
yamlResourceName: yaml-templates
dependsOn: sign_net_mac_win
artifactName: nuget-signed
artifactPatterns: |
!*Darwin*
propsArtifactName: $(NuGetArtifactName)
${{ if and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.DefinitionName'], 'Xamarin.Android')) }}:
signType: Real
${{ else }}:
signType: Test
preConvertSteps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: nuget-signed
artifactPatterns: |
*Darwin*
downloadPath: $(Build.StagingDirectory)\drop\nugets
- task: DownloadPipelineArtifact@2
inputs:
artifactName: nuget-linux-signed
downloadPath: $(Build.StagingDirectory)\drop\nugets
postConvertSteps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: $(Build.StagingDirectory)\sign-verify
patterns: |
**/SignVerifyIgnore.txt
- task: MicroBuildCodesignVerify@3
displayName: verify signed msi content
inputs:
TargetFolders: |
$(Build.ArtifactStagingDirectory)\bin\manifests
$(Build.ArtifactStagingDirectory)\bin\manifests-packs
$(Build.ArtifactStagingDirectory)\bin\msi-nupkgs
ExcludeSNVerify: true
ApprovalListPathForCerts: $(Build.StagingDirectory)\sign-verify\SignVerifyIgnore.txt
# Check - "Xamarin.Android (Prepare .NET Release Publish symbols and Push to Maestro)"
- job: push_signed_nugets
displayName: Publish symbols and Push to Maestro
dependsOn:
- nuget_convert
- sign_net_linux
condition: and(or(eq(dependencies.nuget_convert.result, 'Succeeded'), eq(dependencies.nuget_convert.result, 'SucceededWithIssues')), or(eq(dependencies.sign_net_linux.result, 'Succeeded'), eq(dependencies.sign_net_linux.result, 'SucceededWithIssues')))
timeoutInMinutes: 90
pool:
name: AzurePipelines-EO
image: $(WindowsPoolImage1ESPT)
os: windows
workspace:
clean: all
templateContext:
outputs:
- output: artifactsDrop
dropServiceURI: https://devdiv.artifacts.visualstudio.com/DefaultCollection
buildNumber: $(ReleaseDropPrefix)/symbols
dropMetadataContainerName: DropMetadata-shipping-symbols
sourcePath: $(Build.StagingDirectory)\symbols
retentionDays: 120
toLowerCase: false
steps:
- checkout: self
clean: true
submodules: recursive
- template: /build-tools/automation/yaml-templates/use-dot-net.yaml@self
parameters:
version: $(DotNetSdkVersion)
quality: $(DotNetSdkQuality)
# Download symbols to be published to the symbols artifact drop declared above
- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(WindowsToolchainPdbArtifactName)
downloadPath: $(Build.StagingDirectory)\symbols
- task: DownloadPipelineArtifact@2
inputs:
artifactName: nuget-unsigned-symbols
downloadPath: $(Build.StagingDirectory)\symbols
- task: DownloadPipelineArtifact@2
inputs:
artifactName: nuget-linux-unsigned-symbols
downloadPath: $(Build.StagingDirectory)\symbols
- task: DownloadPipelineArtifact@2
inputs:
artifactName: DropMetadata-shipping-nugets
downloadPath: $(Build.StagingDirectory)\metadata
displayName: Download nugets drop metadata
- powershell: |
$jsonContent = Get-Content -Path "$(Build.StagingDirectory)\metadata\VSTSDrop.json" -Raw | ConvertFrom-Json
$dropPrefix = $jsonContent.VstsDropBuildArtifact.VstsDropUrl -replace 'https://devdiv.artifacts.visualstudio.com/DefaultCollection/_apis/drop/drops/' -replace '/nugets'
Write-Host "##vso[task.setvariable variable=ReleaseDropPrefix]$dropPrefix"
displayName: Set variable ReleaseDropPrefix
# Download nugets drop created by nuget-msi-convert/job/v5.yml and publish to maestro
- task: ms-vscs-artifact.build-tasks.artifactDropDownloadTask-1.artifactDropDownloadTask@1
displayName: Download $(ReleaseDropPrefix)/nugets
inputs:
dropServiceURI: https://devdiv.artifacts.visualstudio.com/DefaultCollection
buildNumber: $(ReleaseDropPrefix)/nugets
destinationPath: $(Build.StagingDirectory)\nuget-signed
- task: DotNetCoreCLI@2
displayName: build Xamarin.Android.Tools.BootstrapTasks.sln
inputs:
projects: $(System.DefaultWorkingDirectory)\Xamarin.Android.BootstrapTasks.sln
arguments: -c $(XA.Build.Configuration) -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\bootstrap.binlog
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))
- ${{ if eq(variables['Build.DefinitionName'], 'Xamarin.Android') }}:
- task: AzureCLI@2
displayName: generate and publish BAR manifest
inputs:
azureSubscription: "Darc: Maestro Production"
scriptType: ps
scriptLocation: inlineScript
inlineScript: >-
dotnet build $(System.DefaultWorkingDirectory)\build-tools\create-packs\Microsoft.Android.Sdk.proj
-t:PushManifestToBuildAssetRegistry
-p:OutputPath=$(Build.StagingDirectory)\nuget-signed\
-c $(XA.Build.Configuration) -bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\push-bar-manifest.binlog
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))
- task: AzureCLI@2
inputs:
azureSubscription: "Darc: Maestro Production"
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
$versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16'
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
& dotnet tool update microsoft.dotnet.darc --version "$darcVersion" --source "$arcadeServicesSource" --tool-path $(Agent.ToolsDirectory)\darc -v n
& $(Agent.ToolsDirectory)\darc\darc add-build-to-channel --default-channels --id $(BARBuildId) --ci --publishing-infra-version 3 --azdev-pat $(System.AccessToken)
displayName: add build to default darc channel
condition: and(succeeded(), eq('${{ parameters.pushXAPackagesToMaestro }}', 'true'))
- template: build-tools\automation\yaml-templates\upload-results.yaml@self
parameters:
xaSourcePath: $(System.DefaultWorkingDirectory)
artifactName: Prepare Release - Push Internal
includeBuildResults: true
# Check - "Xamarin.Android (PoliCheck PoliCheck $(Language))"
- template: security/policheck/v3.yml@yaml-templates
parameters:
windowsImageOverride: $(WindowsPoolImage1ESPT)
stageDependsOn: []
tsaConfigFile: $(Build.SourcesDirectory)\.gdn\tsaoptions-v2.json
tsaUploadEnabled: true
policheckLocScanEnabled: true
policheckExclusionFilesFolder: $(Build.SourcesDirectory)\.gdn\policheck
policheckGdnSuppressionFilesFolder: $(Build.SourcesDirectory)\.gdn\policheck
policheckChsScanFolder: $(Build.SourcesDirectory)\Localize\loc\zh-Hans
policheckChtScanFolder: $(Build.SourcesDirectory)\Localize\loc\zh-Hant
policheckCsyScanFolder: $(Build.SourcesDirectory)\Localize\loc\cs
policheckDeuScanFolder: $(Build.SourcesDirectory)\Localize\loc\de
policheckEsnScanFolder: $(Build.SourcesDirectory)\Localize\loc\es
policheckFraScanFolder: $(Build.SourcesDirectory)\Localize\loc\fr
policheckItaScanFolder: $(Build.SourcesDirectory)\Localize\loc\it
policheckJpnScanFolder: $(Build.SourcesDirectory)\Localize\loc\ja
policheckKorScanFolder: $(Build.SourcesDirectory)\Localize\loc\ko
policheckPlkScanFolder: $(Build.SourcesDirectory)\Localize\loc\pl
policheckPtbScanFolder: $(Build.SourcesDirectory)\Localize\loc\pt-BR
policheckRusScanFolder: $(Build.SourcesDirectory)\Localize\loc\ru
policheckTrkScanFolder: $(Build.SourcesDirectory)\Localize\loc\tr
- ${{ if eq(variables['Build.DefinitionName'], 'Xamarin.Android-PR') }}:
- stage: BuildSummary
dependsOn:
- mac_build
- win_build_test
- linux_build
- smoke_tests
- linux_tests
- msbuild_dotnet
- msbuilddevice_tests
- maui_tests
condition: failed()
jobs:
- template: build-summary/v1.yml@yaml-templates