Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions eng/devices/android.cake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var testAppPackageName = Argument("package", EnvironmentVariable("ANDROID_TEST_A
var testAppInstrumentation = Argument("instrumentation", EnvironmentVariable("ANDROID_TEST_APP_INSTRUMENTATION") ?? "");
var testResultsPath = Argument("results", EnvironmentVariable("ANDROID_TEST_RESULTS") ?? GetTestResultsDirectory()?.FullPath);
var deviceCleanupEnabled = Argument("cleanup", true);
var useCoreClr = Argument("coreclr", false);

// Device details
var deviceSkin = Argument("skin", EnvironmentVariable("ANDROID_TEST_SKIN") ?? "Nexus 5X");
Expand Down Expand Up @@ -56,6 +57,7 @@ Information("Project File: {0}", projectPath);
Information("Build Binary Log (binlog): {0}", binlogDirectory);
Information("Build Configuration: {0}", configuration);
Information("Build Target Framework: {0}", targetFramework);
Information("Use CoreCLR: {0}", useCoreClr);

var avdSettings = new AndroidAvdManagerToolSettings { SdkRoot = androidSdkRoot };
var adbSettings = new AdbToolSettings { SdkRoot = androidSdkRoot };
Expand Down Expand Up @@ -92,7 +94,7 @@ Task("buildOnly")
.WithCriteria(!string.IsNullOrEmpty(projectPath))
.Does(() =>
{
ExecuteBuild(projectPath, testDevice, binlogDirectory, configuration, targetFramework, dotnetToolPath);
ExecuteBuild(projectPath, testDevice, binlogDirectory, configuration, targetFramework, dotnetToolPath, useCoreClr);
});

Task("testOnly")
Expand Down Expand Up @@ -144,10 +146,12 @@ Task("logcat")

RunTarget(TARGET);

void ExecuteBuild(string project, string device, string binDir, string config, string tfm, string toolPath)
void ExecuteBuild(string project, string device, string binDir, string config, string tfm, string toolPath, bool useCoreClr)
{
var projectName = System.IO.Path.GetFileNameWithoutExtension(project);
var binlog = $"{binDir}/{projectName}-{config}-android.binlog";
bool isUsingCoreClr = useCoreClr.ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase);
var monoRuntime = isUsingCoreClr ? "coreclr" : "mono";
var binlog = $"{binDir}/{projectName}-{config}-{monoRuntime}-android.binlog";

DotNetBuild(project, new DotNetBuildSettings
{
Expand All @@ -158,9 +162,17 @@ void ExecuteBuild(string project, string device, string binDir, string config, s
MaxCpuCount = 0
},
ToolPath = toolPath,
ArgumentCustomization = args => args
.Append("/p:EmbedAssembliesIntoApk=true")
.Append("/bl:" + binlog)
ArgumentCustomization = args =>
{
args.Append("/p:EmbedAssembliesIntoApk=true")
.Append("/bl:" + binlog);

if (isUsingCoreClr)
{
args.Append("/p:UseMonoRuntime=false");
}
return args;
}
});
}

Expand Down
13 changes: 8 additions & 5 deletions eng/pipelines/common/device-tests-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:
useArtifacts: false
cakeArgs: ''
buildAndTest: true
useCoreClr: false # Use CoreCLR for Android builds
targetFrameworkVersion:
tfm: ''
dependsOn: ''
Expand All @@ -23,11 +24,11 @@ parameters:

jobs:
- ${{ if eq(parameters.buildAndTest, 'false') }}:
- job: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_build
- job: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_build_${{ parameters.useCoreClr }}
timeoutInMinutes: 60
workspace:
clean: all
displayName: Build ${{ parameters.platform }} ${{ parameters.project.desc }}
displayName: Build ${{ parameters.platform }} ${{ parameters.project.desc }} ${{ iif(eq(parameters.useCoreClr, 'true'), ' (CoreCLR)', '(Mono)') }}
pool: ${{ parameters.pool }}
variables:
REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE)
Expand All @@ -48,15 +49,16 @@ jobs:
deviceTestConfiguration: ${{ parameters.project.configuration }}
skipProvisioning: ${{ parameters.skipProvisioning }}
appArtifactName: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_build
useCoreClr: ${{ parameters.useCoreClr }}
- ${{ each version in parameters.versions }}:
- ${{ if not(containsValue(parameters.project.versionsExclude, version)) }}:
- job: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_${{ replace(replace(version, '.', ''), '-', '') }}
- job: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_${{ replace(replace(version, '.', ''), '-', '') }}_${{ parameters.useCoreClr }}
${{ if eq(parameters.buildAndTest, 'false') }}:
dependsOn: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_build
dependsOn: ${{ parameters.platform }}_device_tests_${{ parameters.project.name }}_build_${{ parameters.useCoreClr }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
workspace:
clean: all
displayName: Run ${{ parameters.platform }} ${{ parameters.project.desc }} ${{ version }}
displayName: Run ${{ parameters.platform }} ${{ parameters.project.desc }} ${{ version }} ${{ iif(eq(parameters.useCoreClr, 'true'), ' (CoreCLR)', '(Mono)') }}
pool: ${{ parameters.pool }}
variables:
REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE)
Expand Down Expand Up @@ -101,3 +103,4 @@ jobs:
deviceTestConfiguration: ${{ parameters.project.configuration }}
skipProvisioning: ${{ parameters.skipProvisioning }}
skipDotNet: ${{ eq(parameters.buildAndTest, 'false') }}
useCoreClr: ${{ parameters.useCoreClr }}
9 changes: 5 additions & 4 deletions eng/pipelines/common/device-tests-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
poolName: 'Azure Pipelines'
skipDotNet: false
buildType: 'buildAndTest' # [ buildAndTest, buildOnly, testOnly ]
useCoreClr: false # Use CoreCLR for Android builds

steps:

Expand Down Expand Up @@ -120,15 +121,15 @@ steps:
displayName: 'Download Build'
condition: and(succeeded(), eq('${{ parameters.buildType }}', 'testOnly'))
inputs:
artifactName: ${{ parameters.appArtifactName }}
artifactName: ${{ parameters.appArtifactName }}_${{ iif(eq(parameters.useCoreClr, 'true'), 'coreclr', 'mono') }}
targetPath: ${{ parameters.checkoutDirectory }}/artifacts/bin

##################################################
# Build / Run #
##################################################

# First run the build if this is a build-only or build-and-test job
- script: dotnet cake eng/devices/${{ parameters.platform }}.cake --target="buildOnly" --project="${{ parameters.path }}" --binlog="$(LogDirectory)" --configuration="${{ parameters.deviceTestConfiguration }}" --targetFrameworkVersion="${{ parameters.targetFrameworkVersion }}" ${{ iif(eq(parameters.device, ''), '', format('--device="{0}"', parameters.device)) }} ${{ iif(eq(parameters.apiversion, ''), '', format('--apiversion="{0}"', parameters.apiversion)) }} --create="${{ ne(parameters.buildType, 'buildOnly') }}" --packageid "${{ parameters.packageid }}" --results="$(TestResultsDirectory)" --workloads="${{ iif(eq(parameters.skipDotNet, 'true'), 'global', 'local') }}" --verbosity=diagnostic ${{ parameters.cakeArgs }}
- script: dotnet cake eng/devices/${{ parameters.platform }}.cake --target="buildOnly" --project="${{ parameters.path }}" --coreclr="${{ parameters.useCoreClr }}" --binlog="$(LogDirectory)" --configuration="${{ parameters.deviceTestConfiguration }}" --targetFrameworkVersion="${{ parameters.targetFrameworkVersion }}" ${{ iif(eq(parameters.device, ''), '', format('--device="{0}"', parameters.device)) }} ${{ iif(eq(parameters.apiversion, ''), '', format('--apiversion="{0}"', parameters.apiversion)) }} --create="${{ ne(parameters.buildType, 'buildOnly') }}" --packageid "${{ parameters.packageid }}" --results="$(TestResultsDirectory)" --workloads="${{ iif(eq(parameters.skipDotNet, 'true'), 'global', 'local') }}" --verbosity=diagnostic ${{ parameters.cakeArgs }}
displayName: Execute Build
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), ne('${{ parameters.buildType }}', 'testOnly'))
Expand Down Expand Up @@ -158,11 +159,11 @@ steps:
- publish: ${{ parameters.checkoutDirectory }}/artifacts/bin
displayName: Publish Succeeded Artifacts Directory
condition: succeeded()
artifact: ${{ parameters.appArtifactName }}
artifact: ${{ parameters.appArtifactName }}_${{ iif(eq(parameters.useCoreClr, 'true'), 'coreclr', 'mono') }}
- publish: ${{ parameters.checkoutDirectory }}/artifacts/bin
displayName: Publish Failed Artifacts Directory
condition: not(succeeded())
artifact: ${{ parameters.appArtifactName }}_failed_$(System.JobAttempt)
artifact: ${{ parameters.appArtifactName }}_${{ iif(eq(parameters.useCoreClr, 'true'), 'coreclr', 'mono') }}_failed_$(System.JobAttempt)

# Publish the test results
- ${{ if ne(parameters.buildType, 'buildOnly') }}:
Expand Down
26 changes: 26 additions & 0 deletions eng/pipelines/common/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,32 @@ stages:
artifactItemPattern: ${{ parameters.artifactItemPattern }}
useArtifacts: ${{ parameters.useArtifacts }}

- ${{ if eq(platform, 'android') }}:
- ${{ each project in parameters.projects }}:
- ${{ if ne(project.android, '') }}:
- template: device-tests-jobs.yml
parameters:
buildAndTest: false
platform: android
timeoutInMinutes: 60
pool: ${{ parameters.androidPool }}
versions: ${{ parameters.androidApiLevels }}
targetFrameworkVersion: ${{ parameters.targetFrameworkVersion }}
checkoutDirectory: ${{ parameters.checkoutDirectory }}
project:
name: ${{ project.name }}
desc: ${{ project.desc }}
path: ${{ project.android }}
versionsExclude: ${{ project.androidApiLevelsCoreClrExclude }}
configuration: ${{ project.androidConfiguration }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
skipProvisioning: ${{ parameters.skipProvisioning }}
agentPoolAccessToken: ${{ parameters.agentPoolAccessToken }}
artifactName: ${{ parameters.artifactName }}
artifactItemPattern: ${{ parameters.artifactItemPattern }}
useArtifacts: ${{ parameters.useArtifacts }}
useCoreClr: true

- ${{ if eq(platform, 'ios') }}:
- ${{ each project in parameters.projects }}:
- ${{ if ne(project.ios, '') }}:
Expand Down
5 changes: 5 additions & 0 deletions eng/pipelines/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ stages:
- name: essentials
desc: Essentials
androidApiLevelsExclude: [ 25, 27 ] # Ignore for now API25 since the runs's are not stable
androidApiLevelsCoreClrExclude: [ 27, 25, 23]
androidConfiguration: 'Release'
iOSConfiguration: 'Debug'
windowsConfiguration: 'Debug'
Expand All @@ -197,6 +198,7 @@ stages:
- name: graphics
desc: Graphics
androidApiLevelsExclude: [ 25, 28 ] # Ignore for now API25 since the runs's are not stable
androidApiLevelsCoreClrExclude: [ 28, 25, 23]
androidConfiguration: 'Release'
iOSConfiguration: 'Debug'
windowsConfiguration: 'Debug'
Expand All @@ -208,6 +210,7 @@ stages:
- name: core
desc: Core
androidApiLevelsExclude: [ 25 ] # Ignore for now API25 since the runs's are not stable
androidApiLevelsCoreClrExclude: [ 25, 23]
androidConfiguration: 'Release'
iOSConfiguration: 'Debug'
windowsConfiguration: 'Debug'
Expand All @@ -219,6 +222,7 @@ stages:
- name: controls
desc: Controls
androidApiLevelsExclude: [ 27, 25 ] # Ignore for now API25 since the runs's are not stable
androidApiLevelsCoreClrExclude: [ 27, 25, 23]
androidConfiguration: 'Debug'
iOSConfiguration: 'Debug'
windowsConfiguration: 'Debug'
Expand All @@ -230,6 +234,7 @@ stages:
- name: blazorwebview
desc: BlazorWebView
androidApiLevelsExclude: [ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21 ] # BlazorWebView requires a recent version of Chrome
androidApiLevelsCoreClrExclude: [ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21]
androidConfiguration: 'Release'
iOSConfiguration: 'Debug'
windowsConfiguration: 'Debug'
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Disable multi-RID builds to workaround a parallel build issue -->
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst')) and '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">maccatalyst-arm64</RuntimeIdentifier>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">android-arm64;android-x86;android-x64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">android-arm64;android-x64</RuntimeIdentifiers>
<IsTestProject>true</IsTestProject>
<ExcludeMicrosoftNetTestSdk>true</ExcludeMicrosoftNetTestSdk>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Core/tests/DeviceTests/Core.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Disable multi-RID builds to workaround a parallel build issue -->
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst')) and '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">maccatalyst-arm64</RuntimeIdentifier>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm64;android-x86;android-x64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm64;android-x64</RuntimeIdentifiers>
<IsTestProject>true</IsTestProject>
<ExcludeMicrosoftNetTestSdk>true</ExcludeMicrosoftNetTestSdk>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- Disable multi-RID builds to workaround a parallel build issue -->
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst')) and '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">maccatalyst-arm64</RuntimeIdentifier>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">android-arm64;android-x86;android-x64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">android-arm64;android-x64</RuntimeIdentifiers>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI, if you have tests that run on a really old API level somewhere (maybe main?), you might need android-x86 in some cases. It depends on if Google put out an x86_64 emulator image for each version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah on our main build we run from 23/33

<ExcludeMicrosoftNetTestSdk>true</ExcludeMicrosoftNetTestSdk>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Graphics/tests/DeviceTests/Graphics.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- Disable multi-RID builds to workaround a parallel build issue -->
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst')) and '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">maccatalyst-arm64</RuntimeIdentifier>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm64;android-x86;android-x64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('-android'))">android-arm64;android-x64</RuntimeIdentifiers>
<ExcludeMicrosoftNetTestSdk>true</ExcludeMicrosoftNetTestSdk>
</PropertyGroup>

Expand Down
Loading