forked from xamarin/Essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
264 lines (253 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
variables:
CurrentSemanticVersionBase: '1.4.0'
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)]
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)'
NugetPackageVersion: '$(CurrentSemanticVersion)'
MONO_VERSION: 6_4_0
XCODE_VERSION: 11.1
NETCORE_VERSION: '3.0.x'
NETCORE_TEST_VERSION: '2.2.x'
IOS_SIM_NAME: 'iPhone 11'
IOS_SIM_RUNTIME: 'com.apple.CoreSimulator.SimRuntime.iOS-13-2'
ANDROID_EMU_TARGET: 'system-images;android-26;google_apis;x86'
ANDROID_EMU_DEVICE: 'Nexus 5X'
RunPoliCheck: 'false'
resources:
repositories:
- repository: xamarin-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
jobs:
- job: build_windows
displayName: Build Windows Library
pool:
vmImage: windows-2019
steps:
# if this is a tagged build, then update the version number
- powershell: |
$buildSourceBranch = "$(Build.SourceBranch)"
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
displayName: Set NuGet Version to Tag Number
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
# restore, build and pack the packages
- task: MSBuild@1
displayName: Build Solution
inputs:
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
configuration: Release
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
- task: MSBuild@1
displayName: Pack NuGets
inputs:
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
configuration: Release
msbuildArguments: '/t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
- task: DotNetCoreCLI@2
displayName: Run Tests
inputs:
command: test
projects: 'Tests/Tests.csproj'
arguments: '--configuration Release'
# publish the packages
- task: PublishBuildArtifacts@1
displayName: 'Publish Unsigned NuGets'
inputs:
artifactName: nuget
pathToPublish: '$(Build.ArtifactStagingDirectory)/nuget'
# make sure we are following the rules, but only on the main build
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Component Detection - Log
inputs:
scanType: LogOnly
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
displayName: Component Detection - Report
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
condition: eq(variables['RunPoliCheck'], 'true')
displayName: 'PoliCheck'
inputs:
targetType: F
- job: build_macos
displayName: Build macOS Library
pool:
vmImage: macos-10.14
steps:
# if this is a tagged build, then update the version number
- powershell: |
$buildSourceBranch = "$(Build.SourceBranch)"
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
displayName: Set NuGet Version to Tag Number
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
# make sure to select the correct Xamarin and mono
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
displayName: Switch to the latest Xamarin SDK
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: Switch to the latest Xcode
# restore, build and pack the packages
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
inputs:
version: $(NETCORE_VERSION)
includePreviewVersions: false
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
inputs:
version: $(NETCORE_TEST_VERSION)
includePreviewVersions: false
- task: MSBuild@1
displayName: Build Solution
inputs:
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
configuration: Release
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
- task: MSBuild@1
displayName: Pack NuGets
inputs:
solution: Xamarin.Essentials/Xamarin.Essentials.csproj
configuration: Release
msbuildArguments: '/t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
- task: DotNetCoreCLI@2
displayName: Run Tests
inputs:
command: test
projects: 'Tests/Tests.csproj'
arguments: '--configuration Release'
- job: build_samples
displayName: Build Samples
pool:
vmImage: windows-2019
steps:
# restore, build and pack the packages
- task: MSBuild@1
displayName: Build Solution
inputs:
solution: Xamarin.Essentials.sln
configuration: Release
msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
- job: devicetests_uwp
displayName: Run UWP Device Tests
dependsOn:
- build_windows
- build_macos
# skip for now
condition: and(succeeded(), not(succeeded()))
pool:
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'
- job: devicetests_ios
displayName: Run iOS Device Tests
dependsOn:
- build_windows
- build_macos
pool:
vmImage: macos-10.14
steps:
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
displayName: Switch to the latest Xamarin SDK
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: Switch to the latest Xcode
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
inputs:
version: $(NETCORE_VERSION)
includePreviewVersions: false
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
inputs:
version: $(NETCORE_TEST_VERSION)
includePreviewVersions: false
- task: InstallAppleCertificate@2
displayName: 'Install an Apple certificate'
inputs:
certSecureFile: 'Components iOS Certificate.p12'
- task: InstallAppleProvisioningProfile@1
displayName: 'Install an Apple provisioning profile'
inputs:
provProfileSecureFile: 'Components iOS Provisioning.mobileprovision'
- bash: |
cd DeviceTests
sh ./build.sh --target=test-ios-emu --settings_skipverification=true --verbosity=diagnostic
displayName: 'Run Device Tests - iOS'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: XUnit
testResultsFiles: '**/xunit-*.xml'
testRunTitle: 'Device Tests - iOS'
- job: devicetests_android
displayName: Run Android Device Tests
dependsOn:
- build_windows
- build_macos
pool:
vmImage: macos-10.14
steps:
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
displayName: Switch to the latest Xamarin SDK
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: Switch to the latest Xcode
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
inputs:
version: $(NETCORE_VERSION)
includePreviewVersions: false
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
inputs:
version: $(NETCORE_TEST_VERSION)
includePreviewVersions: false
- bash: sh -c "echo \"y\" | $ANDROID_HOME/tools/bin/sdkmanager \"$ANDROID_EMU_TARGET\""
displayName: Install the Android emulators
- bash: |
PATH="$ANDROID_HOME/tools/bin:$PATH"
PATH="$ANDROID_HOME/emulator:$PATH"
cd DeviceTests
sh ./build.sh --target=test-android-emu --settings_skipverification=true --verbosity=diagnostic
displayName: 'Run Device Tests - Android'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: XUnit
testResultsFiles: '**/xunit-*.xml'
testRunTitle: 'Device Tests - Android'
# only sign the packages when running on Windows, and using the private server which has the certificates
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- job: signing
displayName: Signing NuGets
dependsOn: build_windows
pool:
name: VSEng-XamarinCustom
demands:
- corpnet
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
steps:
# don't checkout code and sign the packages
- checkout: none
- template: sign-artifacts.yml@xamarin-templates
parameters:
targetFolder: '$(Build.ArtifactStagingDirectory)/signed'
# publish the signed packages
- task: PublishBuildArtifacts@1
displayName: 'Publish Signed NuGets'
inputs:
artifactName: nuget-signed
pathToPublish: '$(Build.ArtifactStagingDirectory)/signed'