Skip to content

Commit

Permalink
[ci] Use static pool for MSBuild emulator test jobs
Browse files Browse the repository at this point in the history
Moves MSBuild emulator test jobs to a static machine pool containing
mac minis to try to improve reliability and performance.
  • Loading branch information
pjcollins committed Aug 1, 2023
1 parent 80a4716 commit e12fd86
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions build-tools/create-packs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<_WLExtractedFiles Include="$(_SdkManifestsFolder)temp\LICENSE" />
<_WLExtractedFiles Include="$(_SdkManifestsFolder)temp\data\*" />
</ItemGroup>
<Touch Files="@(_WLExtractedFiles)" />
<Move SourceFiles="@(_WLExtractedFiles)" DestinationFolder="$(_SdkManifestsFolder)microsoft.net.sdk.android" />
<RemoveDir Directories="$(_SdkManifestsFolder)temp\" />

Expand Down Expand Up @@ -140,6 +141,10 @@
WorkingDirectory="$(_TempDirectory)"
/>
<RemoveDir Directories="$(_TempDirectory)" />
<ItemGroup>
<_ExtractedPackContent Include="$(DotNetPreviewPath)packs\Microsoft.Android*\**" />
</ItemGroup>
<Touch Files="@(_ExtractedPackContent)" />
</Target>

<Target Name="DeleteExtractedWorkloadPacks" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<GenerateDocumentation>True</GenerateDocumentation>
</PropertyGroup>

<Import Project="..\..\Configuration.props" />

<ItemGroup>
<Compile Include="..\..\src-ThirdParty\NUnitLite\**\*.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)}";
Expand Down
2 changes: 1 addition & 1 deletion tests/MSBuildDeviceIntegration/Tests/AotProfileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
8 changes: 4 additions & 4 deletions tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 ());
Expand Down Expand Up @@ -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 ();
Expand Down Expand Up @@ -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)))
Expand Down
18 changes: 9 additions & 9 deletions tests/MSBuildDeviceIntegration/Tests/InstallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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 ("<application ", "<application android:debuggable=\"true\" ");
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
}
using (var builder = CreateApkBuilder ()) {
Assert.IsTrue (builder.Build (proj));
Expand Down Expand Up @@ -97,7 +97,7 @@ public void ChangeKeystoreRedeploy ()
var proj = new XamarinAndroidApplicationProject () {
PackageName = "com.xamarin.keytest"
};
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
using (var builder = CreateApkBuilder ()) {
// Use the default debug.keystore XA generates
Assert.IsTrue (builder.Install (proj), "first install should succeed.");
Expand Down Expand Up @@ -128,7 +128,7 @@ public void SwitchConfigurationsShouldRedeploy ()
};
// Set debuggable=true to allow run-as command usage with a release build
proj.AndroidManifest = proj.AndroidManifest.Replace ("<application ", "<application android:debuggable=\"true\" ");
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
proj.SetProperty ("AndroidPackageFormat", "apk");
using (var builder = CreateApkBuilder ()) {
Assert.IsTrue (builder.Build (proj));
Expand Down Expand Up @@ -180,7 +180,7 @@ public void InstallWithoutSharedRuntime ()
} else {
proj.RemoveProperty (proj.ReleaseProperties, "EmbedAssembliesIntoApk");
}
var abis = new [] { "armeabi-v7a", "x86", "x86_64" };
var abis = new [] { "arm64-v8a", "x86_64" };
proj.SetAndroidSupportedAbis (abis);
using (var builder = CreateApkBuilder ()) {
if (RunAdbCommand ("shell pm list packages Mono.Android.DebugRuntime").Trim ().Length != 0)
Expand Down Expand Up @@ -270,7 +270,7 @@ public void ToggleFastDev ()

//Now toggle FastDev to OFF
proj.EmbedAssembliesIntoApk = true;
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");

Assert.IsTrue (builder.Install (proj), "Second install should have succeeded.");

Expand Down Expand Up @@ -302,7 +302,7 @@ public void ToggleDebugReleaseWithSigning ([Values ("aab", "apk")] string packag
proj.SetProperty (proj.ReleaseProperties, "AndroidKeyStore", "True");
proj.SetProperty (proj.ReleaseProperties, "AndroidSigningKeyStore", "test.keystore");
proj.SetProperty (proj.ReleaseProperties, "AndroidSigningKeyAlias", "mykey");
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
proj.SetProperty (proj.ReleaseProperties, "AndroidPackageFormat", packageFormat);
proj.SetProperty ("AndroidUseApkSigner", "true");
proj.OtherBuildItems.Add (new BuildItem (BuildActions.None, "test.keystore") {
Expand Down Expand Up @@ -338,7 +338,7 @@ public void LoggingPropsShouldCreateOverrideDirForRelease ()
};
// Set debuggable=true to allow run-as command usage with a release build
proj.AndroidManifest = proj.AndroidManifest.Replace ("<application ", "<application android:debuggable=\"true\" ");
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");

string wantedFile;
if (Builder.UseDotNet) {
Expand Down Expand Up @@ -438,7 +438,7 @@ public void TestAndroidStoreKey (bool useApkSigner, bool isRelease, string packa
proj.SetProperty ("AndroidSigningStorePass", password);
proj.SetProperty ("AndroidSigningKeyPass", password);
}
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
proj.SetProperty ("AndroidKeyStore", androidKeyStore);
proj.SetProperty ("AndroidSigningKeyStore", "test.keystore");
proj.SetProperty ("AndroidSigningKeyAlias", "mykey");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected override void OnCreate (Bundle bundle)
}
}
}";
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");
proj.SetProperty ("EmbedAssembliesIntoApk", embedAssemblies.ToString ());
proj.SetDefaultTargetDevice ();
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void SystemApplicationCanInstall ()
WebContent = "https://github.com/aosp-mirror/platform_build/raw/master/target/product/security/platform.x509.pem"
});
proj.AndroidManifest = proj.AndroidManifest.Replace ("<manifest ", "<manifest android:sharedUserId=\"android.uid.system\" ");
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
proj.SetAndroidSupportedAbis ("arm64-v8a", "x86_64");


proj.SetDefaultTargetDevice ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>

<Import Project="..\..\..\Configuration.props" />

<ItemGroup>
<AndroidAsset Include="..\LinkedAssets\linked_text2.txt">
<Link>Assets\linked_text2.txt</Link>
Expand Down
2 changes: 2 additions & 0 deletions tests/TestRunner.Core/TestRunner.Core.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<Import Project="..\..\Configuration.props" />

</Project>
2 changes: 2 additions & 0 deletions tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<Import Project="..\..\Configuration.props" />

<ItemGroup>
<ProjectReference Include="..\TestRunner.Core\TestRunner.Core.NET.csproj" />
<ProjectReference Include="..\..\src\Xamarin.Android.NUnitLite\Xamarin.Android.NUnitLite.NET.csproj" />
Expand Down

0 comments on commit e12fd86

Please sign in to comment.