-
Notifications
You must be signed in to change notification settings - Fork 397
/
azure-pipelines.yml
500 lines (438 loc) · 25.4 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
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
variables:
CurrentSemanticVersionBase: '99.0.0'
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)]
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)'
NugetPackageVersion: '$(CurrentSemanticVersion)'
NugetPackageVersionCamera: '$(CurrentSemanticVersion)'
NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)'
NugetPackageVersionMaps: '$(CurrentSemanticVersion)'
TOOLKIT_NET_VERSION: '8.0.303'
LATEST_NET_VERSION: '8.0.x'
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'
PathToCommunityToolkitCsproj: 'src/CommunityToolkit.Maui/CommunityToolkit.Maui.csproj'
PathToCommunityToolkitCoreCsproj: 'src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj'
PathToCommunityToolkitCameraCsproj: 'src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj'
PathToCommunityToolkitMediaElementCsproj: 'src/CommunityToolkit.Maui.MediaElement/CommunityToolkit.Maui.MediaElement.csproj'
PathToCommunityToolkitMapsCsproj: 'src/CommunityToolkit.Maui.Maps/CommunityToolkit.Maui.Maps.csproj'
PathToCommunityToolkitSampleCsproj: 'samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj'
PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit.Maui.UnitTests/CommunityToolkit.Maui.UnitTests.csproj'
PathToCommunityToolkitAnalyzersCsproj: 'src/CommunityToolkit.Maui.Analyzers/CommunityToolkit.Maui.Analyzers.csproj'
PathToCommunityToolkitCameraAnalyzersCsproj: 'src/CommunityToolkit.Maui.Camera.Analyzers/CommunityToolkit.Maui.Camera.Analyzers.csproj'
PathToCommunityToolkitMediaElementAnalyzersCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers/CommunityToolkit.Maui.MediaElement.Analyzers.csproj'
PathToCommunityToolkitSourceGeneratorsCsproj: 'src/CommunityToolkit.Maui.SourceGenerators/CommunityToolkit.Maui.SourceGenerators.csproj'
PathToCommunityToolkitSourceGeneratorsInternalCsproj: 'src/CommunityToolkit.Maui.SourceGenerators.Internal/CommunityToolkit.Maui.SourceGenerators.Internal.csproj'
PathToCommunityToolkitAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitCameraAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes/CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj'
PathToCommunityToolkitAnalyzersBenchmarkCsproj: 'src/CommunityToolkit.Maui.Analyzers.Benchmarks/CommunityToolkit.Maui.Analyzers.Benchmarks.csproj'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.6.json'
CommunityToolkitSampleApp_Xcode_Version: '16'
CommunityToolkitLibrary_Xcode_Version: '15.4'
trigger:
branches:
include:
- main
- develop
tags:
include:
- '*'
paths:
exclude:
- README.md
pr:
autoCancel: 'true'
branches:
include:
- main
- develop
paths:
exclude:
- README.md
jobs:
- job: build_sample
displayName: Build Sample App using Latest .NET SDK
strategy:
matrix:
'Windows':
image: 'windows-latest'
'macOS':
image: 'macos-14'
pool:
vmImage: $(image)
steps:
- task: CmdLine@2
displayName: 'Set Xcode v$(CommunityToolkitSampleApp_Xcode_Version)'
condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS
inputs:
script: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitSampleApp_Xcode_Version).app/Contents/Developer
- task: UseDotNet@2
displayName: 'Install Latest .NET SDK, v$(LATEST_NET_VERSION)'
inputs:
packageType: 'sdk'
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: false
- task: CmdLine@2
displayName: 'Install Latest .NET MAUI Workload'
inputs:
script: 'dotnet workload install maui'
- powershell: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
.\workload-install.ps1
displayName: Install Tizen Workload
# Print Information on the .NET SDK Used By the CI Build Host
# These logs are useful information when debugging CI Builds
# Note: This step doesn't execute nor modify any code; it is strictly used for logging + debugging purposes
- task: CmdLine@2
displayName: 'Display dotnet --info'
inputs:
script: dotnet --info
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Analyzers'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Analyzers.CodeFixes'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCodeFixCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.SourceGenerators'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.SourceGenerators.Internal'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsInternalCsproj)'
# build sample
- task: CmdLine@2
displayName: 'Build Community Toolkit Sample'
inputs:
script: 'dotnet build $(PathToCommunityToolkitSampleCsproj) -c Release'
- job: build_library
displayName: Build Library
strategy:
matrix:
'Windows':
image: 'windows-latest'
'macOS':
image: 'macos-14'
pool:
vmImage: $(image)
steps:
# if this is a tagged build for CommunityToolkit.Maui, 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: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), not(endsWith(variables['Build.SourceBranch'], '-mediaelement'))) # Only run this step when a Tag has triggered the CI Pipeline
# if this is a tagged build for CommunityToolkit.Maui.Camera, then update the version number
- powershell: |
$buildSourceBranch = "$(Build.SourceBranch)"
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
$tagVersion = $tagVersion.Substring(0, $tagVersion.LastIndexOf("-"))
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionCamera;]$tagVersion")
displayName: Set NuGet Version to Tag Number
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-camera')) # Only run this step when a Tag has triggered the CI Pipeline
# if this is a tagged build for CommunityToolkit.Maui.MediaElement, then update the version number
- powershell: |
$buildSourceBranch = "$(Build.SourceBranch)"
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
$tagVersion = $tagVersion.Substring(0, $tagVersion.LastIndexOf("-"))
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMediaElement;]$tagVersion")
displayName: Set NuGet Version to Tag Number
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-mediaelement')) # Only run this step when a Tag has triggered the CI Pipeline
# if this is a tagged build for CommunityToolkit.Maui.Maps, then update the version number
- powershell: |
$buildSourceBranch = "$(Build.SourceBranch)"
$tagVersion = $buildSourceBranch.Substring($buildSourceBranch.LastIndexOf("/") + 1)
$tagVersion = $tagVersion.Substring(0, $tagVersion.LastIndexOf("-"))
Write-Host("Branch = $buildSourceBranch, Version = $tagVersion");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMaps;]$tagVersion")
displayName: Set NuGet Version to Tag Number
condition: and(startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-maps')) # Only run this step when a Tag has triggered the CI Pipeline
# if this is a PR build, then update the version number
- powershell: |
$prNumber = $env:System_PullRequest_PullRequestNumber
$commitId = "$($env:System_PullRequest_SourceCommitId)".Substring(0, 7)
$fullVersionString = "$(CurrentSemanticVersionBase)-build-$prNumber.$(Build.BuildId)+$commitId"
Write-Host("GitHub PR = $prNumber, Commit = $commitId");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$fullVersionString")
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMediaElement;]$fullVersionString")
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMaps;]$fullVersionString")
Write-Host "##vso[build.updatebuildnumber]$fullVersionString"
displayName: Set NuGet Version to PR Version
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['build.reason'], 'PullRequest')) # Only run this step on Windows when a Pull Request has triggered the CI Pipeline
- task: CmdLine@2
displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)'
condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS
inputs:
script: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app;sudo xcode-select --switch /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app/Contents/Developer
- task: UseDotNet@2
displayName: Install .NET v$(TOOLKIT_NET_VERSION)
inputs:
packageType: 'sdk'
version: '$(TOOLKIT_NET_VERSION)'
includePreviewVersions: false
- task: CmdLine@2
displayName: 'Install .NET MAUI Workload $(TOOLKIT_NET_VERSION)'
inputs:
script: dotnet workload install maui --skip-sign-check --source https://api.nuget.org/v3/index.json
- powershell: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
.\workload-install.ps1
displayName: Install Tizen Workload
# Print Information on the .NET SDK Used By the CI Build Host
# These logs are useful information when debugging CI Builds
# Note: This step doesn't execute nor modify any code; it is strictly used for logging + debugging purposes
- task: CmdLine@2
displayName: 'Display dotnet --info'
inputs:
script: dotnet --info
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Analyzers'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Analyzers.CodeFixes'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitAnalyzersCodeFixCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Camera.Analyzers'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitCameraAnalyzersCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Camera.Analyzers.CodeFixes'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitCameraAnalyzersCodeFixCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.SourceGenerators'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.SourceGenerators.Internal'
inputs:
script: 'dotnet build -c Release $(PathToCommunityToolkitSourceGeneratorsInternalCsproj)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Core'
inputs:
script: 'dotnet build $(PathToCommunityToolkitCoreCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui'
inputs:
script: 'dotnet build $(PathToCommunityToolkitCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Camera'
inputs:
script: 'dotnet build $(PathToCommunityToolkitCameraCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionCamera)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.MediaElement'
inputs:
script: 'dotnet build $(PathToCommunityToolkitMediaElementCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMediaElement)'
- task: CmdLine@2
displayName: 'Build CommunityToolkit.Maui.Maps'
inputs:
script: 'dotnet build $(PathToCommunityToolkitMapsCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMaps)'
- task: CmdLine@2
displayName: 'Run CommunityToolkit.Maui.Analyzers.UnitTests'
env:
VSTEST_TESTHOST_SHUTDOWN_TIMEOUT: 1100 # Fixes "The active test run was aborted. Reason: Test host process crashed" https://dev.azure.com/dotnet/CommunityToolkit/_build/results?buildId=109660&view=logs&j=3f96dcf5-6e1e-5485-3200-c557d5216be3&t=12286b69-c788-55db-0a8c-ef899858fbe6&l=76 (source: https://github.com/microsoft/vstest/issues/2952#issuecomment-2234253765): $(sauceUsername)
inputs:
script: 'dotnet test $(PathToCommunityToolkitAnalyzersUnitTestCsproj) -c Release'
- task: CmdLine@2
displayName: 'Run CommunityToolkit.Maui.UnitTests'
env:
VSTEST_TESTHOST_SHUTDOWN_TIMEOUT: 1100 # Fixes "The active test run was aborted. Reason: Test host process crashed" https://dev.azure.com/dotnet/CommunityToolkit/_build/results?buildId=109660&view=logs&j=3f96dcf5-6e1e-5485-3200-c557d5216be3&t=12286b69-c788-55db-0a8c-ef899858fbe6&l=76 (source: https://github.com/microsoft/vstest/issues/2952#issuecomment-2234253765): $(sauceUsername)
inputs:
script: 'dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release --settings ".runsettings" --collect "XPlat code coverage" --logger trx --results-directory $(Agent.TempDirectory)'
- task: PublishTestResults@2
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
displayName: 'Publish Test Results'
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/*.trx'
searchFolder: $(Agent.TempDirectory)
- task: PublishCodeCoverageResults@2
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
displayName: 'Publish Code Coverage Results'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
failIfCoverageEmpty: true
- task: CmdLine@2
displayName: 'Pack CommunityToolkit.Maui.Core NuGet'
inputs:
script: 'dotnet pack $(PathToCommunityToolkitCoreCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)'
- task: CmdLine@2
displayName: 'Pack CommunityToolkit.Maui NuGet'
inputs:
script: 'dotnet pack $(PathToCommunityToolkitCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)'
- task: CmdLine@2
displayName: 'Pack CommunityToolkit.Maui.Camera NuGet'
inputs:
script: 'dotnet pack $(PathToCommunityToolkitCameraCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionCamera)'
- task: CmdLine@2
displayName: 'Pack CommunityToolkit.Maui.MediaElement NuGet'
inputs:
script: 'dotnet pack $(PathToCommunityToolkitMediaElementCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMediaElement)'
- task: CmdLine@2
displayName: 'Pack CommunityToolkit.Maui.Maps NuGet'
inputs:
script: 'dotnet pack $(PathToCommunityToolkitMapsCsproj) -c Release -p:PackageVersion=$(NugetPackageVersionMaps)'
# check vulnerabilities
- powershell: |
cd src
dotnet list package --include-transitive # Print all transitive packages
dotnet list package --vulnerable --include-transitive | findstr /S /c:"has the following vulnerable packages"; # Print all transitive packages with vulnerabilities
if ($LastExitCode -ne 1)
{
dotnet list package --vulnerable --include-transitive;
exit 1;
}
exit 0;
displayName: 'Check Dependencies'
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
# Copy all NuGet packages
- task: PowerShell@2
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))) # Only run this step on Windows and when it's not a tagged build
displayName: 'Copy NuGet Packages to Staging Directory'
inputs:
targetType: 'inline'
script: |
$source = ".\src"
$filter = "nupkg"
Get-ChildItem -Path $source -Recurse | Where-Object { $_.Extension -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
pwsh: true
# Copy CommunityToolkit.Maui & CommunityToolkit.Maui.Core packages
- task: PowerShell@2
condition: and(eq(variables['Agent.OS'], 'Windows_NT'),
startsWith(variables['Build.SourceBranch'], 'refs/tags/'),
not(endsWith(variables['Build.SourceBranch'], '-mediaelement')),
not(endsWith(variables['Build.SourceBranch'], '-maps')),
not(endsWith(variables['Build.SourceBranch'], '-camera'))) # Only run this step on Windows and when it's a tagged build and the tag does NOT end with -mediaelement and does NOT end with -maps and does NOT end with -camera
displayName: 'Copy CommunityToolkit.Maui & CommunityToolkit.Maui.Core NuGet Packages to Staging Directory'
inputs:
targetType: 'inline'
script: |
$source = ".\src"
$filter = "CommunityToolkit.Maui.(Core.)*[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg"
Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
pwsh: true
# Copy CommunityToolkit.Maui.Camera package
- task: PowerShell@2
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-camera')) # Only run this step on Windows and when it's a tagged build and the tag ends with -camera
displayName: 'Copy CommunityToolkit.Maui.Camera NuGet Package to Staging Directory'
inputs:
targetType: 'inline'
script: |
$source = ".\src"
$filter = "CommunityToolkit.Maui.Camera.[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg"
Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
pwsh: true
# Copy CommunityToolkit.Maui.MediaElement package
- task: PowerShell@2
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-mediaelement')) # Only run this step on Windows and when it's a tagged build and the tag ends with -mediaelement
displayName: 'Copy CommunityToolkit.Maui.MediaElement NuGet Package to Staging Directory'
inputs:
targetType: 'inline'
script: |
$source = ".\src"
$filter = "CommunityToolkit.Maui.MediaElement.[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg"
Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
pwsh: true
# Copy CommunityToolkit.Maui.Maps package
- task: PowerShell@2
condition: and(eq(variables['Agent.OS'], 'Windows_NT'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), endsWith(variables['Build.SourceBranch'], '-maps')) # Only run this step on Windows and when it's a tagged build and the tag ends with -maps
displayName: 'Copy CommunityToolkit.Maui.Maps NuGet Package to Staging Directory'
inputs:
targetType: 'inline'
script: |
$source = ".\src"
$filter = "CommunityToolkit.Maui.Maps.[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]*)*.nupkg"
Get-ChildItem -Path $source -Recurse | Where-Object { $_.Name -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
pwsh: true
# Sign NuGet Packages
- task: PowerShell@2
displayName: Authenticode Sign Packages
inputs:
filePath: build/Sign-Package.ps1
env:
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
ArtifactDirectory: $(Build.ArtifactStagingDirectory)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], ''))) # Only run this step on Windows when the CI Pipeline has not been triggered by a Pull Request and the NuGet Signing Certificate is valid
# Publish build artifacts
- task: PublishBuildArtifacts@1
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
displayName: 'Publish NuGets'
inputs:
artifactName: nuget
pathToPublish: '$(Build.ArtifactStagingDirectory)'
- job: run_benchmarks
displayName: Run Benchmarks
strategy:
matrix:
'Windows':
image: 'windows-latest'
'macOS':
image: 'macos-14'
pool:
vmImage: $(image)
steps:
- script: |
sudo xcode-select -s /Applications/Xcode_$(CommunityToolkitLibrary_Xcode_Version).app
sudo xcode-select -p
displayName: 'Set Xcode v$(CommunityToolkitLibrary_Xcode_Version)'
condition: eq(variables['Agent.OS'], 'Darwin') # Only run this step on macOS
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: false
- task: CmdLine@2
displayName: 'Install .NET MAUI Workload'
inputs:
script : 'dotnet workload install maui'
- pwsh: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
.\workload-install.ps1
displayName: Install Tizen Workload
# Print Information on the .NET SDK Used By the CI Build Host
# These logs are useful information when debugging CI Builds
# Note: This step doesn't execute nor modify any code; it is strictly used for logging + debugging purposes
- task: CmdLine@2
displayName: 'Display dotnet --info'
inputs:
script: dotnet --info
- task: CmdLine@2
displayName: 'Run Benchmarks'
inputs:
script : 'dotnet run --project $(PathToCommunityToolkitAnalyzersBenchmarkCsproj) -c Release -- -a $(Build.ArtifactStagingDirectory)'
# publish the Benchmark Results
- task: PublishBuildArtifacts@1
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
displayName: 'Publish Benchmark Artifacts'
inputs:
artifactName: benchmarks
pathToPublish: '$(Build.ArtifactStagingDirectory)'