From db357c7dbb3fb310a9dbde43d4c53fc790af9367 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Wed, 15 Jan 2025 07:17:19 -1000 Subject: [PATCH] [ci] Run Mac MSBuild tests on `macos-14-arm64` (#9665) Azure Pipelines now provides the `macos-14-arm64` image. We can use this image to run our MSBuild tests on. This is a benefit because it's nearly twice as fast and nowadays our Mac users are probably more likely to be running arm64. Unfortunately it [does not support nested virtualization](https://github.com/actions/runner-images/issues/9460), so we can't run our emulator tests on this image. Supposedly Apple added nested virtualization in MacOS 15, but Azure does not have `macos-15-arm64` images yet. Hopefully we will be able to use those for emulator tests in the future. Additionally: - Update `apkdiff` to a [newer version with Apple Silicon support](https://github.com/radekdoulik/apkdiff/pull/8). - Tweak agent count since we now need fewer Mac agents, but could use a couple more Windows agents. - Bugfix to make sure we're using the right JDK path for ARM64. --- .../automation/yaml-templates/setup-jdk-variables.yaml | 6 +++--- .../yaml-templates/stage-msbuild-emulator-tests.yaml | 4 ++-- .../automation/yaml-templates/stage-msbuild-tests.yaml | 4 ++-- .../automation/yaml-templates/stage-package-tests.yaml | 4 ++-- build-tools/automation/yaml-templates/variables.yaml | 4 +++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build-tools/automation/yaml-templates/setup-jdk-variables.yaml b/build-tools/automation/yaml-templates/setup-jdk-variables.yaml index 780952babd4..8282fcaf6a9 100644 --- a/build-tools/automation/yaml-templates/setup-jdk-variables.yaml +++ b/build-tools/automation/yaml-templates/setup-jdk-variables.yaml @@ -1,11 +1,11 @@ parameters: - jdkMajorVersion: $(DefaultJavaSdkMajorVersion) - useAgentJdkPath: true + jdkMajorVersion: $(DefaultJavaSdkMajorVersion) # Generally 11|17|21 + useAgentJdkPath: true # true to use preinstalled agent JDK, false to use 'android-toolchain/jdk-NN' steps: - pwsh: | $agentOS="$(Agent.OS)" - $agentArch="$(Agent.OSArchitecture)" + $agentArch="$(Agent.OSArchitecture)" -eq "ARM64" ? "arm64" : "$(Agent.OSArchitecture)" $jdkMajorVersion="${{ parameters.jdkMajorVersion }}" $xaPrepareJdkPath="$env:HOME/android-toolchain/jdk-$jdkMajorVersion" if ("$agentOS" -eq "Windows_NT") { diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml index 43875cc2fca..aa27d4dc9a4 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -27,7 +27,7 @@ stages: displayName: "macOS > Tests > MSBuild+Emulator" pool: name: Azure Pipelines - vmImage: $(HostedMacImage) + vmImage: $(HostedMacImageWithEmulator) os: macOS timeoutInMinutes: 180 cancelTimeoutInMinutes: 5 @@ -89,7 +89,7 @@ stages: deviceName: wear_square pool: name: Azure Pipelines - vmImage: $(HostedMacImage) + vmImage: $(HostedMacImageWithEmulator) os: macOS workspace: clean: all diff --git a/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml index 434de192f42..54fb9005e16 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml @@ -22,7 +22,7 @@ stages: testOS: macOS jobName: mac_msbuild_tests jobDisplayName: macOS > Tests > MSBuild - agentCount: 14 + agentCount: 10 xaSourcePath: ${{ parameters.xaSourcePath }} repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} @@ -34,7 +34,7 @@ stages: testOS: Windows jobName: win_msbuild_tests jobDisplayName: Windows > Tests > MSBuild - agentCount: 6 + agentCount: 8 xaSourcePath: ${{ parameters.xaSourcePath }} repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} diff --git a/build-tools/automation/yaml-templates/stage-package-tests.yaml b/build-tools/automation/yaml-templates/stage-package-tests.yaml index 60a495df5de..20511486a33 100644 --- a/build-tools/automation/yaml-templates/stage-package-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-package-tests.yaml @@ -13,7 +13,7 @@ stages: displayName: macOS > Tests > APKs 1 pool: name: Azure Pipelines - vmImage: $(HostedMacImage) + vmImage: $(HostedMacImageWithEmulator) os: macOS timeoutInMinutes: 180 workspace: @@ -120,7 +120,7 @@ stages: displayName: macOS > Tests > APKs 2 pool: name: Azure Pipelines - vmImage: $(HostedMacImage) + vmImage: $(HostedMacImageWithEmulator) os: macOS timeoutInMinutes: 180 workspace: diff --git a/build-tools/automation/yaml-templates/variables.yaml b/build-tools/automation/yaml-templates/variables.yaml index 48b60fe65f3..d1abe276018 100644 --- a/build-tools/automation/yaml-templates/variables.yaml +++ b/build-tools/automation/yaml-templates/variables.yaml @@ -14,7 +14,7 @@ variables: - name: WindowsToolchainPdbArtifactName value: windows-toolchain-pdb - name: ApkDiffToolVersion - value: 0.0.15 + value: 0.0.17 - name: TestSlicerToolVersion value: 0.1.0-alpha7 - name: BootsToolVersion @@ -30,6 +30,8 @@ variables: - name: GitHub.Token value: $(github--pat--vs-mobiletools-engineering-service2) - name: HostedMacImage + value: macOS-14-arm64 +- name: HostedMacImageWithEmulator value: macOS-14 - name: SharedMacPool value: VSEng-VSMac-Xamarin-Shared