Skip to content

Commit

Permalink
[CI] Break "Linux Tests" into 2 parallel jobs. (#9642)
Browse files Browse the repository at this point in the history
The "Linux Tests" stage/job regularly approaches an hour runtime, after a ~17 minute Linux build.  This puts it beyond our "ideal" 1 hour PR CI build.

Manually split the job up into 2 jobs that each run in parallel to reduce the overall runtime.
  • Loading branch information
jpobst authored Jan 7, 2025
1 parent 679bb84 commit 217b244
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 87 deletions.
61 changes: 1 addition & 60 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,66 +108,7 @@ extends:
parameters:
macTestAgentsUseCleanImages: ${{ parameters.macTestAgentsUseCleanImages }}

- stage: linux_tests
displayName: Linux Tests
dependsOn:
- mac_build
- linux_build
jobs:
# Check - "Xamarin.Android (Linux Tests Linux > Tests > MSBuild)"
- job: linux_tests_smoke
displayName: Linux > Tests > MSBuild
pool:
name: MAUI-1ESPT
image: $(LinuxPoolImage1ESPT)
os: linux
timeoutInMinutes: 180
workspace:
clean: all
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml@self

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml@self
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux BuildTest
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = BuildTest"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml@self
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux PackagingTest
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = PackagingTest"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml@self
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux XASdkTests
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = XASdkTests & Name != XamarinLegacySdk"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml@self
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux AndroidDependenciesTests
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = AndroidDependenciesTests"

- task: ShellScript@2
displayName: Test dotnet-local.sh
inputs:
scriptPath: dotnet-local.sh
args: build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj

- template: /build-tools/automation/yaml-templates/upload-results.yaml@self
parameters:
configuration: $(XA.Build.Configuration)
artifactName: Test Results - MSBuild - Linux

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml@self
- template: /build-tools/automation/yaml-templates/stage-linux-tests.yaml@self

- template: /build-tools/automation/yaml-templates/stage-msbuild-tests.yaml@self

Expand Down
87 changes: 87 additions & 0 deletions build-tools/automation/yaml-templates/stage-linux-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Runs smoke tests on Linux packages.

stages:
- stage: linux_tests
displayName: Linux Tests
dependsOn:
- mac_build
- linux_build
jobs:
# Check - "Xamarin.Android (Linux Tests Linux > Tests > MSBuild)"
- job: linux_tests_smoke_1
displayName: Linux > Tests > MSBuild 1
pool:
name: MAUI-1ESPT
image: $(LinuxPoolImage1ESPT)
os: linux
timeoutInMinutes: 180
workspace:
clean: all
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux BuildTest
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = BuildTest"

- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
configuration: $(XA.Build.Configuration)
artifactName: Test Results - MSBuild - Linux 1

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml

- job: linux_tests_smoke_2
displayName: Linux > Tests > MSBuild 2
pool:
name: MAUI-1ESPT
image: $(LinuxPoolImage1ESPT)
os: linux
timeoutInMinutes: 180
workspace:
clean: all
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux PackagingTest
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = PackagingTest"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux XASdkTests
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = XASdkTests & Name != XamarinLegacySdk"

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Build.Tests - Linux AndroidDependenciesTests
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "Name = AndroidDependenciesTests"

- task: ShellScript@2
displayName: Test dotnet-local.sh
inputs:
scriptPath: dotnet-local.sh
args: build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj

- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
configuration: $(XA.Build.Configuration)
artifactName: Test Results - MSBuild - Linux 2

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml
54 changes: 27 additions & 27 deletions build-tools/automation/yaml-templates/stage-package-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stages:
workspace:
clean: all
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml@self
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml
parameters:
xaprepareScenario: EmulatorTestDependencies

Expand All @@ -35,7 +35,7 @@ stages:
projects: $(System.DefaultWorkingDirectory)/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj
arguments: -c Debug -bl:$(System.DefaultWorkingDirectory)/bin/TestDebug/BootstrapTasks.binlog

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
project: Xamarin.Android.sln
arguments: >-
Expand All @@ -44,24 +44,24 @@ stages:
displayName: prepare java.interop Debug
continueOnError: false

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
project: Xamarin.Android.sln
arguments: -t:PrepareJavaInterop -c $(XA.Build.Configuration) --no-restore
displayName: prepare java.interop $(XA.Build.Configuration)
continueOnError: false

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
command: test
project: src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj
arguments: -c $(XA.Build.Configuration)
displayName: Test Microsoft.Android.Sdk.Analysis $(XA.Build.Configuration)
continueOnError: false

- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml@self
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
buildConfiguration: $(XA.Build.Configuration)
configuration: Debug
Expand All @@ -71,7 +71,7 @@ stages:
artifactSource: bin/TestDebug/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.apk
artifactFolder: $(DotNetTargetFramework)-Debug

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-$(XA.Build.Configuration)
Expand All @@ -80,7 +80,7 @@ stages:
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-$(XA.Build.Configuration)

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-NoAab
Expand All @@ -90,7 +90,7 @@ stages:
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.apk
artifactFolder: $(DotNetTargetFramework)-NoAab

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-Interpreter
Expand All @@ -101,20 +101,20 @@ stages:
artifactFolder: $(DotNetTargetFramework)-Interpreter

- ${{ if ne(parameters.macTestAgentsUseCleanImages, true) }}:
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml@self
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml
parameters:
command: stop

- template: /build-tools/automation/yaml-templates/upload-results.yaml@self
- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
artifactName: Test Results - APKs .NET $(XA.Build.Configuration) - macOS 1

- template: /build-tools/automation/yaml-templates/upload-results.yaml@self
- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
artifactName: Test Results - APKs .NET Debug - macOS 1
configuration: Debug

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml@self
- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml

- job: mac_apk_tests_net_2
displayName: macOS > Tests > APKs 2
Expand All @@ -126,7 +126,7 @@ stages:
workspace:
clean: all
steps:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml@self
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml
parameters:
xaprepareScenario: EmulatorTestDependencies

Expand All @@ -142,7 +142,7 @@ stages:
projects: $(System.DefaultWorkingDirectory)/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj
arguments: -c Debug -bl:$(System.DefaultWorkingDirectory)/bin/TestDebug/BootstrapTasks.binlog

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
project: Xamarin.Android.sln
arguments: >-
Expand All @@ -151,24 +151,24 @@ stages:
displayName: prepare java.interop Debug
continueOnError: false

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
project: Xamarin.Android.sln
arguments: -t:PrepareJavaInterop -c $(XA.Build.Configuration) --no-restore
displayName: prepare java.interop $(XA.Build.Configuration)
continueOnError: false

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml@self
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
command: test
project: src/Microsoft.Android.Sdk.Analysis/Tests/Microsoft.Android.Sdk.Analysis.Tests.csproj
arguments: -c $(XA.Build.Configuration)
displayName: Test Microsoft.Android.Sdk.Analysis $(XA.Build.Configuration)
continueOnError: false

- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml@self
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-NoAot
Expand All @@ -178,7 +178,7 @@ stages:
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-NoAot

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-TrimModePartial
Expand All @@ -188,7 +188,7 @@ stages:
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-TrimModePartial

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-AotLlvm
Expand All @@ -198,7 +198,7 @@ stages:
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-AotLlvm

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
configuration: $(XA.Build.Configuration)
testName: Xamarin.Android.JcwGen_Tests
Expand All @@ -207,7 +207,7 @@ stages:
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.JcwGen_Tests-Signed.apk
artifactFolder: $(DotNetTargetFramework)-Default

- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml@self
- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml
parameters:
testRunTitle: Xamarin.Android.Tools.Aidl-Tests - macOS
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Tools.Aidl-Tests.dll
Expand All @@ -219,17 +219,17 @@ stages:
args: build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj

- ${{ if ne(parameters.macTestAgentsUseCleanImages, true) }}:
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml@self
- template: /build-tools/automation/yaml-templates/start-stop-emulator.yaml
parameters:
command: stop

- template: /build-tools/automation/yaml-templates/upload-results.yaml@self
- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
artifactName: Test Results - APKs .NET $(XA.Build.Configuration) - macOS 2

- template: /build-tools/automation/yaml-templates/upload-results.yaml@self
- template: /build-tools/automation/yaml-templates/upload-results.yaml
parameters:
artifactName: Test Results - APKs .NET Debug - macOS 2
configuration: Debug

- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml@self
- template: /build-tools/automation/yaml-templates/fail-on-issue.yaml

0 comments on commit 217b244

Please sign in to comment.