forked from xamarin/Essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
248 lines (233 loc) · 10.7 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
trigger:
- main
- develop
- refs/tags/*
pr:
- main
- develop
variables:
BASE_VERSION: 1.7.1
PREVIEW_LABEL: 'ci'
BUILD_NUMBER: $[counter(format('{0}_{1}_{2}', variables['BASE_VERSION'], variables['PREVIEW_LABEL'], variables['Build.SourceBranch']), 1)]
NUGET_VERSION: $[format('{0}-{1}.{2}', variables['BASE_VERSION'], variables['PREVIEW_LABEL'], variables['BUILD_NUMBER'])]
GIT_SHA: $(Build.SourceVersion)
GIT_BRANCH_NAME: $(Build.SourceBranchName)
AREA_PATH: 'DevDiv\Xamarin SDK\Build and Tools'
Codeql.Enabled: true
resources:
repositories:
- repository: internal-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
- repository: components
type: github
name: xamarin/XamarinComponents
ref: refs/heads/main
endpoint: xamarin
stages:
- stage: build
displayName: Build Library
jobs:
- template: .ci/build.v1.yml@components
parameters:
dotnet: '3.1.415'
dotnetStable: '3.1.415'
${{ if eq(variables['System.TeamProject'], 'devdiv') }}: # The AzurePipelines-EO pool is only available in DevDiv
windowsAgentPoolName: AzurePipelines-EO
windowsImage: '' # Override the 'windows-latest' default settings
windowsImageOverride: AzurePipelinesWindows2019compliant
${{ if ne(variables['System.TeamProject'], 'devdiv') }}:
windowsImage: windows-2019
areaPath: 'DevDiv\Xamarin SDK'
masterBranchName: 'main'
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}: #we are shipping our product
cakeTarget: ci-release # We just want to build the library and nuget
macosImage: '' # We don't need the macOS build
preBuildSteps:
- pwsh: |
$pr = "pr." + $env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
$nuget = $env:BASE_VERSION + "-" + $pr + "." + $env:BUILD_NUMBER
Write-Host "Preview label: $pr"
Write-Host "NuGet version: $nuget"
Write-Host "##vso[task.setvariable variable=PREVIEW_LABEL]$pr"
Write-Host "##vso[task.setvariable variable=NUGET_VERSION]$nuget"
displayName: Use a special preview label for PRs
condition: eq(variables['Build.Reason'], 'PullRequest')
- pwsh: |
$tagVersion = $env:BUILD_SOURCEBRANCHNAME
Write-Host "Tag version: $tagVersion"
Write-Host "##vso[task.setvariable variable=NUGET_VERSION]$tagVersion"
displayName: Override version for tags
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
- pwsh: |
Write-Host "##vso[build.updatebuildnumber]$env:NUGET_VERSION"
displayName: Update the build number with a more readable one
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- stage: signing
displayName: Sign Artifacts
dependsOn: [ 'build' ]
jobs:
- template: sign-artifacts/jobs/v2.yml@internal-templates
parameters:
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
- stage: sbom
displayName: 'Software Bill of Materials'
${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/tags/')) }}:
dependsOn: [ 'build' ]
${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
dependsOn: [ 'signing' ]
jobs:
- template: compliance/sbom/job.v1.yml@internal-templates # Software Bill of Materials (SBOM): https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/secure-supply-chain/ado-sbom-generator
parameters:
artifactNames: ['nuget']
packageName: 'Xamarin Essentials'
packageFilter: '*.nupkg'
packageVersionRegex: '(?i)^Xamarin.Essentials\.(?<version>\d+\.\d+\.\d+)(.*).nupkg$'
- ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/tags/')) }}:
- stage: devicetests
displayName: Device Tests
dependsOn: []
jobs:
- job: devicetests_uwp
displayName: UWP
# skip for now
condition: false
pool:
${{ if eq(variables['System.TeamProject'], 'devdiv') }}: # The AzurePipelines-EO pool is only available in DevDiv
name: AzurePipelines-EO
demands:
- ImageOverride -equals AzurePipelinesWindows2019compliant
${{ if ne(variables['System.TeamProject'], 'devdiv') }}:
vmImage: windows-2019
steps:
- script: 'certutil -importpfx $(Build.SourcesDirectory)\DeviceTests\DeviceTests.UWP\DeviceTests.UWP_TemporaryKey.pfx'
displayName: 'Run certutil'
- powershell: |
cd DeviceTests
.\build.ps1 --target=test-uwp-emu --settings_skipverification=true --verbosity=diagnostic
displayName: 'Run Device Tests - UWP'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: XUnit
testResultsFiles: '**/xunit-*.xml'
testRunTitle: 'Device Tests - UWP'
- template: .ci/build.v1.yml@components
parameters:
name: devicetests_ios
runChecks: false
displayName: iOS
publishOutputSuffix: '-ios'
windowsImage: ''
areaPath: $(AREA_PATH)
verbosity: diagnostic
cakeFile: DeviceTests/build.cake
cakeTarget: test-ios-emu
xharness: '1.0.0-prerelease.21620.1'
- template: .ci/build.v1.yml@components
parameters:
name: devicetests_android_api_21
runChecks: false
displayName: Android API 21
publishOutputSuffix: '-android21'
windowsImage: '' # Mac only
areaPath: $(AREA_PATH)
verbosity: diagnostic
cakeFile: DeviceTests/build.cake
cakeTarget: test-android-emu
cakeExtraArgs: --avd-target="`"system-images;android-21;google_apis;x86`""
preBuildSteps:
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-21;google_apis;x86\""
displayName: Install the Android emulators
- template: .ci/build.v1.yml@components
parameters:
name: devicetests_android_api_22
runChecks: false
displayName: Android API 22
publishOutputSuffix: '-android22'
windowsImage: '' # Mac only
areaPath: $(AREA_PATH)
verbosity: diagnostic
cakeFile: DeviceTests/build.cake
cakeTarget: test-android-emu
cakeExtraArgs: --avd-target="`"system-images;android-22;google_apis;x86`""
preBuildSteps:
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-22;google_apis;x86\""
displayName: Install the Android emulators
# - template: .ci/build.v1.yml@components
# parameters:
# name: devicetests_android_api_23
# runChecks: false
# continueOnError: true
# displayName: Android API 23
# publishOutputSuffix: '-android23'
# windowsImage: '' # Mac only
# areaPath: $(AREA_PATH)
# verbosity: diagnostic
# cakeFile: DeviceTests/build.cake
# cakeTarget: test-android-emu
# cakeExtraArgs: --avd-target="`"system-images;android-23;google_apis;x86`""
# preBuildSteps:
# - bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-23;google_apis;x86\""
# displayName: Install the Android emulators
- template: .ci/build.v1.yml@components
parameters:
name: devicetests_android_api_24
runChecks: false
displayName: Android API 24
publishOutputSuffix: '-android24'
windowsImage: '' # Mac only
areaPath: $(AREA_PATH)
verbosity: diagnostic
cakeFile: DeviceTests/build.cake
cakeTarget: test-android-emu
cakeExtraArgs: --avd-target="`"system-images;android-24;google_apis;x86`""
preBuildSteps:
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-24;google_apis;x86\""
displayName: Install the Android emulators
- template: .ci/build.v1.yml@components
parameters:
name: devicetests_android_api_26
runChecks: false
displayName: Android API 26
publishOutputSuffix: '-android26'
windowsImage: '' # Mac only
areaPath: $(AREA_PATH)
verbosity: diagnostic
cakeFile: DeviceTests/build.cake
cakeTarget: test-android-emu
cakeExtraArgs: --avd-target="`"system-images;android-26;google_apis;x86`""
preBuildSteps:
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-26;google_apis;x86\""
displayName: Install the Android emulators
- template: .ci/build.v1.yml@components
parameters:
name: devicetests_android_api_29
runChecks: false
displayName: Android API 29
publishOutputSuffix: '-android29'
windowsImage: '' # Mac only
areaPath: $(AREA_PATH)
verbosity: diagnostic
cakeFile: DeviceTests/build.cake
cakeTarget: test-android-emu
cakeExtraArgs: --avd-target="`"system-images;android-29;google_apis;x86`""
preBuildSteps:
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-29;google_apis;x86\""
displayName: Install the Android emulators
# - template: .ci/build.v1.yml@components
# parameters:
# name: devicetests_android_api_30
# runChecks: false
# displayName: Android API 30
# publishOutputSuffix: '-android30'
# windowsImage: '' # Mac only
# areaPath: $(AREA_PATH)
# verbosity: diagnostic
# cakeFile: DeviceTests/build.cake
# cakeTarget: test-android-emu
# cakeExtraArgs: --avd-target="`"system-images;android-30;google_apis;x86`""
# preBuildSteps:
# - bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"system-images;android-30;google_apis;x86\""
# displayName: Install the Android emulators