Skip to content

Commit bf90784

Browse files
committed
[ci] Add MAUI integration job
Adds a new MAUI test stage and job that will run against PR builds targeting xamarin-android/main. The new job will build dotnet/maui against the Android packs produced by the PR build. If that is successful, it will install the MAUI packs into Androids dotnet preview sandbox, and create and build a template.
1 parent 26ffd5d commit bf90784

File tree

2 files changed

+176
-2
lines changed

2 files changed

+176
-2
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 133 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ resources:
3030
name: xamarin/release-scripts
3131
ref: refs/heads/sign-and-notarized
3232
endpoint: xamarin
33+
- repository: maui
34+
type: github
35+
name: dotnet/maui
36+
ref: refs/heads/net8.0
37+
endpoint: xamarin
3338

3439
parameters:
3540
- name: provisionatorChannel
@@ -277,13 +282,139 @@ stages:
277282
artifactName: Test Results - MSBuild Smoke - Linux
278283

279284
- template: yaml-templates/fail-on-issue.yaml
280-
285+
281286
- template: yaml-templates/stage-msbuild-tests.yaml
282-
287+
283288
- template: yaml-templates/stage-msbuild-emulator-tests.yaml
284289
parameters:
285290
usesCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}
286291

292+
- stage: maui_tests
293+
displayName: MAUI Tests
294+
dependsOn: mac_build
295+
condition: eq(variables['System.PullRequest.TargetBranch'], 'main')
296+
jobs:
297+
# Check - "Xamarin.Android (MAUI Tests MAUI Integration)"
298+
- job: maui_tests_integration
299+
displayName: MAUI Integration
300+
pool: $(1ESWindowsPool)
301+
timeoutInMinutes: 180
302+
workspace:
303+
clean: all
304+
variables:
305+
BuildVersion: $(Build.BuildId)
306+
steps:
307+
- checkout: maui
308+
clean: true
309+
submodules: recursive
310+
path: s/maui
311+
persistCredentials: true
312+
313+
- template: yaml-templates/setup-test-environment.yaml
314+
parameters:
315+
xaSourcePath: $(Build.SourcesDirectory)/xamarin-android
316+
provisionClassic: false
317+
provisionatorChannel: ${{ parameters.provisionatorChannel }}
318+
installLegacyDotNet: false
319+
restoreNUnitConsole: false
320+
updateMono: false
321+
androidSdkPlatforms: 23,24,25,26,27,28,29,30,31,32,$(DefaultTestSdkPlatforms)
322+
323+
- task: NuGetAuthenticate@0
324+
displayName: authenticate with azure artifacts
325+
inputs:
326+
forceReinstallCredentialProvider: true
327+
328+
- script: |
329+
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%JAVA_HOME_11_X64%
330+
echo ##vso[task.setvariable variable=JAVA_HOME]%JAVA_HOME_11_X64%
331+
displayName: set JI_JAVA_HOME, JAVA_HOME
332+
333+
- task: DownloadPipelineArtifact@2
334+
inputs:
335+
artifactName: $(NuGetArtifactName)
336+
downloadPath: $(Build.StagingDirectory)/android-packs
337+
338+
- pwsh: |
339+
$searchPath = Join-Path $(Build.StagingDirectory) android-packs
340+
$wlmanPack = Get-ChildItem $searchPath -Filter *Android*Manifest*.nupkg | Select-Object -First 1
341+
$dest = Join-Path $searchPath "tmp-wlman" "$($wlmanPack.BaseName)"
342+
Expand-Archive -LiteralPath $wlmanPack -DestinationPath $dest
343+
$wlmanJsonPath = Join-Path $dest "data" "WorkloadManifest.json"
344+
$json = Get-Content $wlmanJsonPath | ConvertFrom-Json -AsHashtable
345+
Write-Host "Setting variable ANDROID_PACK_VERSION = $($json["version"])"
346+
Write-Host "##vso[task.setvariable variable=ANDROID_PACK_VERSION;]$($json["version"])"
347+
displayName: Set ANDROID_PACK_VERSION
348+
349+
- pwsh: >-
350+
$(Build.SourcesDirectory)/maui/eng/scripts/update-version-props.ps1
351+
-xmlFileName "$(Build.SourcesDirectory)/maui/eng/Versions.props"
352+
-androidVersion $(ANDROID_PACK_VERSION)
353+
displayName: Update MAUI's Android dependency
354+
355+
- pwsh: ./build.ps1 --target=dotnet --configuration="$(XA.Build.Configuration)" --nugetsource="$(Build.StagingDirectory)\android-packs" --verbosity=diagnostic
356+
displayName: Install .NET
357+
retryCountOnTaskFailure: 3
358+
workingDirectory: $(Build.SourcesDirectory)/maui
359+
360+
- pwsh: ./build.ps1 --target=dotnet-pack --configuration="$(XA.Build.Configuration)" --nugetsource="$(Build.StagingDirectory)\android-packs" --verbosity=diagnostic
361+
displayName: Pack .NET Maui
362+
workingDirectory: $(Build.SourcesDirectory)/maui
363+
364+
- task: DotNetCoreCLI@2
365+
displayName: Install MAUI workload packs
366+
retryCountOnTaskFailure: 3
367+
inputs:
368+
projects: $(Build.SourcesDirectory)/xamarin-android/build-tools/create-packs/Microsoft.Android.Sdk.proj
369+
arguments: -t:ExtractMauiWorkloadPacks -c $(XA.Build.Configuration) -v:n -bl:$(Build.StagingDirectory)/logs/extract-workloads.binlog
370+
371+
- template: yaml-templates/run-dotnet-preview.yaml
372+
parameters:
373+
command: new
374+
arguments: maui -o $(Build.StagingDirectory)/MauiTestProj
375+
xaSourcePath: $(Build.SourcesDirectory)/xamarin-android
376+
displayName: Create MAUI template
377+
continueOnError: false
378+
379+
- template: yaml-templates/run-dotnet-preview.yaml
380+
parameters:
381+
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj
382+
arguments: >-
383+
-f $(DotNetTargetFramework)-android -c Debug
384+
--configfile $(Build.SourcesDirectory)/maui/NuGet.config
385+
-bl:$(Build.StagingDirectory)/logs/MauiTestProj-Debug.binlog
386+
xaSourcePath: $(Build.SourcesDirectory)/xamarin-android
387+
displayName: Build MAUI template - Debug
388+
389+
- template: yaml-templates/run-dotnet-preview.yaml
390+
parameters:
391+
project: $(Build.StagingDirectory)/MauiTestProj/MauiTestProj.csproj
392+
arguments: >-
393+
-f $(DotNetTargetFramework)-android -c Release
394+
--configfile $(Build.SourcesDirectory)/maui/NuGet.config
395+
-bl:$(Build.StagingDirectory)/logs/MauiTestProj-Release.binlog
396+
xaSourcePath: $(Build.SourcesDirectory)/xamarin-android
397+
displayName: Build MAUI template - Release
398+
399+
- task: CopyFiles@2
400+
displayName: copy build logs
401+
condition: always()
402+
inputs:
403+
Contents: |
404+
$(Build.SourcesDirectory)/maui/artifacts/logs/**
405+
TargetFolder: $(Build.StagingDirectory)/logs
406+
flattenFolders: true
407+
408+
- template: yaml-templates/publish-artifact.yaml
409+
parameters:
410+
displayName: upload build and test results
411+
artifactName: Test Results - MAUI Integration
412+
targetPath: $(Build.StagingDirectory)/logs
413+
condition: or(ne(variables['Agent.JobStatus'], 'Succeeded'), eq(variables['XA.PublishAllLogs'], 'true'))
414+
415+
- template: yaml-templates/fail-on-issue.yaml
416+
417+
287418
- stage: dotnet_prepare_release
288419
displayName: Prepare .NET Release
289420
dependsOn:

build-tools/create-packs/Directory.Build.targets

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,49 @@
165165
<RemoveDir Directories="@(_PackFoldersToDelete)" />
166166
</Target>
167167

168+
<Target Name="ExtractMauiWorkloadPacks" >
169+
<PropertyGroup>
170+
<MauiSourcePath Condition=" '$(MauiSourcePath)' == '' ">$(XamarinAndroidSourcePath)..\maui</MauiSourcePath>
171+
<MauiPackagePath Condition=" '$(MauiPackagePath)' == '' ">$(MauiSourcePath)\artifacts</MauiPackagePath>
172+
<_SdkManifestsFolder>$(DotNetPreviewPath)sdk-manifests\$(DotNetSdkManifestsFolder)\</_SdkManifestsFolder>
173+
</PropertyGroup>
174+
<ItemGroup>
175+
<_WLManifest Include="$(MauiPackagePath)/Microsoft.NET.Sdk.Maui.Manifest-$(DotNetSdkManifestsFolder.Substring (0,3))*.nupkg" />
176+
</ItemGroup>
177+
<Unzip
178+
SourceFiles="@(_WLManifest)"
179+
DestinationFolder="$(_SdkManifestsFolder)temp"
180+
/>
181+
<ItemGroup>
182+
<_WLExtractedFiles Include="$(_SdkManifestsFolder)temp\LICENSE.TXT" />
183+
<_WLExtractedFiles Include="$(_SdkManifestsFolder)temp\data\*" />
184+
</ItemGroup>
185+
<Move SourceFiles="@(_WLExtractedFiles)" DestinationFolder="$(_SdkManifestsFolder)microsoft.net.sdk.maui" />
186+
<RemoveDir Directories="$(_SdkManifestsFolder)temp\" />
187+
188+
<XmlPeek
189+
XmlInputPath="$(MauiSourcePath)\NuGet.config"
190+
Query="/configuration/packageSources/add/@value">
191+
<Output TaskParameter="Result" ItemName="_NuGetSources" />
192+
</XmlPeek>
193+
<PropertyGroup>
194+
<_TempDirectory>$(IntermediateOutputPath).workload-temp-$([System.IO.Path]::GetRandomFileName())</_TempDirectory>
195+
</PropertyGroup>
196+
<ItemGroup>
197+
<_NuGetSources Include="$(MauiPackagePath.TrimEnd('\'))" />
198+
<_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
199+
<_NuGetSources Include="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
200+
<_InstallArguments Include="--source &quot;%(_NuGetSources.Identity)&quot;" />
201+
</ItemGroup>
202+
<MakeDir Directories="$(_TempDirectory)" />
203+
<Exec
204+
Command="&quot;$(DotNetPreviewTool)&quot; workload install maui --skip-manifest-update --skip-sign-check --verbosity diag --temp-dir &quot;$(_TempDirectory)&quot; @(_InstallArguments, ' ')"
205+
WorkingDirectory="$(_TempDirectory)"
206+
EnvironmentVariables="DOTNET_MULTILEVEL_LOOKUP=0"
207+
/>
208+
<RemoveDir Directories="$(_TempDirectory)" />
209+
</Target>
210+
168211
<Target Name="PushManifestToBuildAssetRegistry" >
169212
<ItemGroup>
170213
<BuildArtifacts Include="$(OutputPath)*.nupkg" />

0 commit comments

Comments
 (0)