From e12fd86424f48241d536e988f23d97fcdba16daa Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Mon, 17 Jul 2023 15:22:36 -0400 Subject: [PATCH] [ci] Use static pool for MSBuild emulator test jobs Moves MSBuild emulator test jobs to a static machine pool containing mac minis to try to improve reliability and performance. --- .../stage-msbuild-emulator-tests.yaml | 16 +++++++++++++--- .../create-packs/Directory.Build.targets | 5 +++++ .../Xamarin.Android.NUnitLite.NET.csproj | 2 ++ .../Resources/LinkDescTest/HttpClientTest.cs | 2 +- .../Tests/AotProfileTests.cs | 2 +- .../Tests/DebuggingTest.cs | 8 ++++---- .../Tests/InstallTests.cs | 18 +++++++++--------- .../Tests/MonoAndroidExportTest.cs | 2 +- .../Tests/SystemApplicationTests.cs | 2 +- .../Mono.Android-Test.Library.NET.csproj | 2 ++ .../TestRunner.Core/TestRunner.Core.NET.csproj | 2 ++ .../TestRunner.NUnit.NET.csproj | 2 ++ 12 files changed, 43 insertions(+), 20 deletions(-) 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 202d6fd696a..94fb73a54ad 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -4,7 +4,7 @@ parameters: stageName: msbuilddevice_tests job_name: 'mac_dotnetdevice_tests' dependsOn: mac_build - agent_count: 8 + agent_count: 4 stageCondition: succeeded() stagePrefix: '' xaSourcePath: $(System.DefaultWorkingDirectory) @@ -25,12 +25,17 @@ stages: parallel: ${{ parameters.agent_count }} displayName: "macOS > Tests > MSBuild+Emulator" pool: - vmImage: $(HostedMacImage) + name: VSEng-VSMac-Xamarin-Shared + demands: + - macOS.Name -equals Ventura + - macOS.Architecture -equals arm64 timeoutInMinutes: 90 cancelTimeoutInMinutes: 5 workspace: clean: all steps: + - template: agent-cleanser/v1.yml@yaml-templates + - template: setup-test-environment.yaml parameters: installTestSlicer: true @@ -88,10 +93,15 @@ stages: deviceName: wear_square androidSdkPlatforms: 33 pool: - vmImage: $(HostedMacImage) + name: VSEng-VSMac-Xamarin-Shared + demands: + - macOS.Name -equals Ventura + - macOS.Architecture -equals arm64 workspace: clean: all steps: + - template: agent-cleanser/v1.yml@yaml-templates + - template: setup-test-environment.yaml parameters: installTestSlicer: true diff --git a/build-tools/create-packs/Directory.Build.targets b/build-tools/create-packs/Directory.Build.targets index ff6d4f99933..e3bff7383d6 100644 --- a/build-tools/create-packs/Directory.Build.targets +++ b/build-tools/create-packs/Directory.Build.targets @@ -106,6 +106,7 @@ <_WLExtractedFiles Include="$(_SdkManifestsFolder)temp\LICENSE" /> <_WLExtractedFiles Include="$(_SdkManifestsFolder)temp\data\*" /> + @@ -140,6 +141,10 @@ WorkingDirectory="$(_TempDirectory)" /> + + <_ExtractedPackContent Include="$(DotNetPreviewPath)packs\Microsoft.Android*\**" /> + + diff --git a/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj b/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj index 83e909c59ac..be22fad857b 100644 --- a/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj +++ b/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj @@ -26,6 +26,8 @@ True + + diff --git a/tests/MSBuildDeviceIntegration/Resources/LinkDescTest/HttpClientTest.cs b/tests/MSBuildDeviceIntegration/Resources/LinkDescTest/HttpClientTest.cs index 123be53d087..2c473ba9d32 100644 --- a/tests/MSBuildDeviceIntegration/Resources/LinkDescTest/HttpClientTest.cs +++ b/tests/MSBuildDeviceIntegration/Resources/LinkDescTest/HttpClientTest.cs @@ -11,7 +11,7 @@ public static string Post () { var client = new HttpClient (); var data = new StringContent ("{\"foo\": \"bar\" }", Encoding.UTF8, "application/json"); - var response = client.PostAsync ("https://httpbin.org/post", data).Result; + var response = client.PostAsync ("https://webhook.site/c8e3ec94-673c-45dd-a660-a44779c9ac69/post", data).Result; response.EnsureSuccessStatusCode (); var json = response.Content.ReadAsStringAsync ().Result; return $"[PASS] {nameof (HttpClientTest)}.{nameof (Post)}"; diff --git a/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs b/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs index df4eca72697..2763ca27aa9 100644 --- a/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs @@ -25,7 +25,7 @@ public void BuildBasicApplicationAndAotProfileIt () IsRelease = true, AotAssemblies = false, }; - proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64"); + proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64"); if (Builder.UseDotNet) { // TODO: only needed in .NET 6+ diff --git a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs index b94326b4684..459fa5d77bd 100755 --- a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs @@ -59,7 +59,7 @@ public void ApplicationRunsWithoutDebugger ([Values (false, true)] bool isReleas IsRelease = isRelease, }; if (isRelease || !CommercialBuildAvailable) { - proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64"); + proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64"); } proj.SetDefaultTargetDevice (); if (Builder.UseDotNet && isRelease) { @@ -91,7 +91,7 @@ public void ClassLibraryMainLauncherRuns ([Values (true, false)] bool preloadAss ProjectName = "MyApp", }; if (!CommercialBuildAvailable) { - app.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64"); + app.SetAndroidSupportedAbis ("arm64-v8a", "x86_64"); } app.SetDefaultTargetDevice (); app.SetProperty ("AndroidEnablePreloadAssemblies", preloadAssemblies.ToString ()); @@ -192,7 +192,7 @@ public void CustomApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, st IsRelease = false, AndroidFastDeploymentType = fastDevType, }; - proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64"); + proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64"); proj.SetProperty ("EmbedAssembliesIntoApk", embedAssemblies.ToString ()); proj.SetProperty ("AndroidPackageFormat", packageFormat); proj.SetDefaultTargetDevice (); @@ -434,7 +434,7 @@ public Foo () app.SetProperty ("AndroidPackageFormat", packageFormat); app.MainPage = app.MainPage.Replace ("InitializeComponent ();", "InitializeComponent (); new Foo ();"); app.AddReference (lib); - app.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64"); + app.SetAndroidSupportedAbis ("arm64-v8a", "x86", "x86_64"); app.SetProperty (KnownProperties._AndroidAllowDeltaInstall, allowDeltaInstall.ToString ()); app.SetDefaultTargetDevice (); using (var libBuilder = CreateDllBuilder (Path.Combine (path, lib.ProjectName))) diff --git a/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs b/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs index 75ffe121ca4..d6963b88138 100644 --- a/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/InstallTests.cs @@ -37,7 +37,7 @@ public void ReInstallIfUserUninstalled ([Values (false, true)] bool isRelease) IsRelease = isRelease, }; if (isRelease) { - proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64"); + proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64"); } using (var builder = CreateApkBuilder ()) { Assert.IsTrue (builder.Build (proj)); @@ -67,7 +67,7 @@ public void InstallAndUnInstall ([Values (false, true)] bool isRelease) if (isRelease) { // Set debuggable=true to allow run-as command usage with a release build proj.AndroidManifest = proj.AndroidManifest.Replace ("Off + + Assets\linked_text2.txt diff --git a/tests/TestRunner.Core/TestRunner.Core.NET.csproj b/tests/TestRunner.Core/TestRunner.Core.NET.csproj index 9d057c00a08..84c59ba7f22 100644 --- a/tests/TestRunner.Core/TestRunner.Core.NET.csproj +++ b/tests/TestRunner.Core/TestRunner.Core.NET.csproj @@ -7,4 +7,6 @@ false + + diff --git a/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj b/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj index 7dac74516c8..fd5d1152a9d 100644 --- a/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj +++ b/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj @@ -8,6 +8,8 @@ false + +