62
62
pool :
63
63
vmImage : windows-2019
64
64
steps :
65
- - task : CmdLine@2
66
- displayName : ' Clear Local NuGet Cache' # https://github.com/actions/virtual-environments/issues/1090#issuecomment-748452120
67
- inputs :
68
- script : ' nuget locals all -clear'
69
- - task : MSBuild@1
70
- displayName : ' Clean Solution'
71
- inputs :
72
- solution : $(PathToSamplesSln)
73
- msbuildArguments : ' /t:Clean'
74
65
- task : MSBuild@1
75
66
displayName : Build Solution
76
67
inputs :
@@ -88,25 +79,19 @@ jobs:
88
79
inputs :
89
80
version : $(NETCORE_VERSION)
90
81
includePreviewVersions : false
82
+
91
83
- task : UseDotNet@2
92
84
displayName : ' Install .NET 3.1 Test SDK'
93
85
inputs :
94
86
version : $(NETCORE_TEST_VERSION_3_1)
95
87
includePreviewVersions : false
88
+
96
89
- task : UseDotNet@2
97
90
displayName : ' Install .NET 2.1 Test SDK'
98
91
inputs :
99
92
version : $(NETCORE_TEST_VERSION_2_1)
100
93
includePreviewVersions : false
101
- - task : CmdLine@2
102
- displayName : ' Clear Local NuGet Cache' # https://github.com/actions/virtual-environments/issues/1090#issuecomment-748452120
103
- inputs :
104
- script : ' nuget locals all -clear'
105
- - task : MSBuild@1
106
- displayName : ' Clean Solution'
107
- inputs :
108
- solution : $(PathToSamplesSln)
109
- msbuildArguments : ' /t:Clean'
94
+
110
95
# if this is a tagged build, then update the version number
111
96
- powershell : |
112
97
$buildSourceBranch = "$(Build.SourceBranch)"
@@ -115,6 +100,7 @@ jobs:
115
100
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
116
101
displayName: Set NuGet Version to Tag Number
117
102
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
103
+
118
104
# if this is a PR build, then update the version number
119
105
- powershell : |
120
106
$prNumber = $env:System_PullRequest_PullRequestNumber
@@ -125,56 +111,68 @@ jobs:
125
111
Write-Host "##vso[build.updatebuildnumber]$fullVersionString"
126
112
displayName: Set NuGet Version to PR Version
127
113
condition: and(succeeded(), eq(variables['build.reason'], 'PullRequest'))
114
+
128
115
# restore, build and pack the packages
129
116
- task : MSBuild@1
130
117
displayName : Build Xamarin.CommunityToolkit.csproj
131
118
inputs :
132
119
solution : $(PathToCommunityToolkitCsproj)
133
120
configuration : Release
134
121
msbuildArguments : ' /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
122
+
135
123
- task : CopyFiles@2
136
124
inputs :
137
125
Contents : ' SignList.xml'
138
- TargetFolder : ' $(Build.ArtifactStagingDirectory)/nuget'
126
+ TargetFolder : ' $(Build.ArtifactStagingDirectory)'
127
+
139
128
- task : MSBuild@1
140
129
displayName : Pack Community Toolkit NuGets
141
130
inputs :
142
131
solution : $(PathToCommunityToolkitCsproj)
143
132
configuration : Release
144
- msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
133
+ msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
134
+
145
135
- task : MSBuild@1
146
136
displayName : Build Markup Project
147
137
inputs :
148
138
solution : $(PathToMarkupCsproj)
149
139
configuration : Release
150
140
msbuildArguments : ' /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
141
+
151
142
- task : MSBuild@1
152
143
displayName : Pack Markup NuGet
153
144
inputs :
154
145
solution : $(PathToMarkupCsproj)
155
146
configuration : Release
156
- msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
157
- # - task: DotNetCoreCLI@2
158
- # displayName: Publish to GitHub NuGet Packages
159
- # condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/main'))
160
- # inputs:
161
- # command: 'custom'
162
- # custom: 'nuget'
163
- # arguments: 'push --source https://nuget.pkg.github.com/xamarin/index.json --api-key $(GitHub.NuGet.Token) "$(Build.ArtifactStagingDirectory)\nuget\*.nupkg"'
147
+ msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
148
+
164
149
- task : CmdLine@2
165
150
displayName : ' Run Markup Unit Tests'
166
151
inputs :
167
152
script : dotnet test $(PathToMarkupUnitTestCsproj) -c Release --collect "Code coverage" -p:BuildInParallel=false
153
+
168
154
- task : CmdLine@2
169
155
displayName : ' Run Community Toolkit Unit Tests'
170
156
inputs :
171
157
script : dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release --collect "Code coverage" -p:BuildInParallel=false
158
+
172
159
# publish the packages
160
+ - task : PowerShell@2
161
+ displayName : ' Copy NuGet Packages to Staging Directory'
162
+ inputs :
163
+ targetType : ' inline'
164
+ script : |
165
+ $source = ".\src"
166
+ $filter = "nupkg"
167
+ Get-ChildItem -Path $source -Recurse | Where-Object { $_.Extension -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
168
+ pwsh : true
169
+
173
170
- task : PublishBuildArtifacts@1
174
171
displayName : ' Publish Unsigned NuGets'
175
172
inputs :
176
173
artifactName : nuget
177
- pathToPublish : ' $(Build.ArtifactStagingDirectory)/nuget'
174
+ pathToPublish : ' $(Build.ArtifactStagingDirectory)'
175
+
178
176
# make sure we are following the rules, but only on the main build
179
177
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }} :
180
178
- task : ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
@@ -202,19 +200,23 @@ jobs:
202
200
script : |
203
201
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 6.0.300-preview.22204.3 --quality preview
204
202
dotnet --info
203
+
205
204
- task : CmdLine@2
206
205
displayName : ' Install .NET MAUI Workload'
207
206
inputs :
208
207
script : ' dotnet workload install maui'
208
+
209
209
- task : JavaToolInstaller@0
210
210
displayName : ' Install Java SDK 11.0'
211
211
inputs :
212
212
versionSpec : ' 11'
213
213
jdkArchitectureOption : ' x64'
214
214
jdkSourceOption : ' PreInstalled'
215
+
215
216
- powershell : |
216
217
$mauiCompatExists = Test-Path -Path "$(PathToMauiCompatCommunityToolkitCsproj)"
217
218
Write-Output "##vso[task.setvariable variable=MauiCompatExists]$mauiCompatExists"
219
+
218
220
- task : CmdLine@2
219
221
displayName : ' Run MauiCompat Generator'
220
222
condition : eq (variables['MauiCompatExists'], False)
@@ -240,21 +242,18 @@ jobs:
240
242
- download : current
241
243
artifact : drop
242
244
243
- - task : CopyFiles@2
244
- inputs :
245
- Contents : ' $(Pipeline.Workspace)\drop\SignList.xml'
246
- TargetFolder : ' $(Build.ArtifactStagingDirectory)/nuget'
247
-
248
245
- powershell : |
249
246
wget https://dot.net/v1/dotnet-install.ps1 -OutFile C:\dotnet-install.ps1
250
247
C:\dotnet-install.ps1 -Version 6.0.300-preview.22204.3
251
248
dotnet --info
252
249
Write-Host "##vso[task.prependpath]C:\\Users\\VssAdministrator\\AppData\\Local\\Microsoft\\dotnet"
253
250
displayName: Install .NET 6.0.300-preview.22204.3
251
+
254
252
- task : CmdLine@2
255
253
displayName : ' Install .NET MAUI Workload'
256
254
inputs :
257
255
script : ' dotnet workload install maui'
256
+
258
257
- task : JavaToolInstaller@0
259
258
displayName : ' Install Java SDK 11.0'
260
259
inputs :
@@ -268,6 +267,7 @@ jobs:
268
267
script : |
269
268
cd $(Pipeline.Workspace)\drop
270
269
dotnet new globaljson --sdk-version 6.0.300-preview.22204.3 --roll-forward latestMajor --force
270
+
271
271
# if this is a tagged build, then update the version number
272
272
- powershell : |
273
273
$buildSourceBranch = "$(Build.SourceBranch)"
@@ -283,21 +283,32 @@ jobs:
283
283
inputs :
284
284
solution : ' $(Pipeline.Workspace)\drop\$(PathToMauiCompatCommunityToolkitCsproj)'
285
285
configuration : ' Release'
286
- msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget" '
286
+ msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg'
287
287
288
288
- task : VSBuild@1
289
289
displayName : ' Build and Pack Markup NuGet'
290
290
inputs :
291
291
solution : ' $(Pipeline.Workspace)\drop\$(PathToMauiCompatMarkupCsproj)'
292
292
configuration : ' Release'
293
- msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget" '
293
+ msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg'
294
294
295
295
# publish the packages
296
+ - task : PowerShell@2
297
+ displayName : ' Copy NuGet Packages to Staging Directory'
298
+ inputs :
299
+ targetType : ' inline'
300
+ script : |
301
+ $source = "$(Pipeline.Workspace)\drop\src"
302
+ $filter = "nupkg"
303
+ Get-ChildItem -Path $source -Recurse | Where-Object { $_.Extension -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
304
+ pwsh : true
305
+
296
306
- task : PublishBuildArtifacts@1
297
307
displayName : ' Publish Unsigned NuGets'
298
308
inputs :
299
309
artifactName : nuget
300
- pathToPublish : ' $(Build.ArtifactStagingDirectory)/nuget'
310
+ pathToPublish : ' $(Build.ArtifactStagingDirectory)'
311
+
301
312
# make sure we are following the rules, but only on the main build
302
313
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }} :
303
314
- task : ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
@@ -327,52 +338,54 @@ jobs:
327
338
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
328
339
displayName: Set NuGet Version to Tag Number
329
340
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
330
- # 16feb21 jfversluis: let's not pin this anymore and use latest
331
- # make sure to select the correct Xamarin and mono
332
- # - bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
333
- # displayName: Switch to the latest Xamarin SDK
334
- # - 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
335
- # displayName: Switch to the latest Xcode
336
- # restore, build and pack the packages
341
+
337
342
- task : UseDotNet@2
338
343
displayName : ' Install .NET SDK'
339
344
inputs :
340
345
version : $(NETCORE_VERSION)
341
346
includePreviewVersions : false
347
+
342
348
- task : UseDotNet@2
343
349
displayName : ' Install .NET 3.1 Test SDK'
344
350
inputs :
345
351
version : $(NETCORE_TEST_VERSION_3_1)
346
352
includePreviewVersions : false
353
+
347
354
- task : UseDotNet@2
348
355
displayName : ' Install .NET 2.1 Test SDK'
349
356
inputs :
350
357
version : $(NETCORE_TEST_VERSION_2_1)
351
358
includePreviewVersions : false
359
+
352
360
- task : CmdLine@2
353
361
displayName : ' Build Markup'
354
362
inputs :
355
363
script : ' $(PathToMsBuildOnMacOS) $(PathToMarkupCsproj) /p:Configuration=Release /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
364
+
356
365
- task : CmdLine@2
357
366
displayName : ' Build Community Toolkit'
358
367
inputs :
359
368
script : ' $(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
369
+
360
370
- task : CmdLine@2
361
371
displayName : ' Run Markup Unit Tests'
362
372
inputs :
363
373
script : ' dotnet test $(PathToMarkupUnitTestCsproj) -c Release -p:BuildInParallel=false'
374
+
364
375
- task : CmdLine@2
365
376
displayName : ' Run Community Toolkit Unit Tests'
366
377
inputs :
367
378
script : ' dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release -p:BuildInParallel=false'
379
+
368
380
- task : CmdLine@2
369
381
displayName : ' Pack Markup NuGets'
370
382
inputs :
371
- script : ' $(PathToMsBuildOnMacOS) $(PathToMarkupUnitTestCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
383
+ script : ' $(PathToMsBuildOnMacOS) $(PathToMarkupUnitTestCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
384
+
372
385
- task : CmdLine@2
373
386
displayName : ' Pack CommunityToolkit NuGets'
374
387
inputs :
375
- script : ' $(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget" '
388
+ script : ' $(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
376
389
377
390
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }} :
378
391
- template : sign-artifacts/jobs/v2.yml@internal-templates
0 commit comments