From 2a73b10566d4816be53802378d63c8d6a5d5c5af Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Tue, 20 Aug 2024 11:30:42 -0500 Subject: [PATCH 1/5] - fix up for release on some device tests but not all yet --- eng/devices/android.cake | 5 ++ eng/pipelines/common/device-tests-steps.yml | 51 +++++++++++++------ eng/pipelines/common/device-tests.yml | 1 + eng/pipelines/device-tests.yml | 7 ++- .../tests/DeviceTests/Core.DeviceTests.csproj | 5 ++ .../StreamImageSourceServiceTests.Android.cs | 2 + 6 files changed, 55 insertions(+), 16 deletions(-) diff --git a/eng/devices/android.cake b/eng/devices/android.cake index 7f6171d8a494..bebcd7487978 100644 --- a/eng/devices/android.cake +++ b/eng/devices/android.cake @@ -234,6 +234,11 @@ void ExecuteTests(string project, string device, string appPath, string appPacka } finally { + if (testsFailed) + { + // uncomment if you want to copy the test app to the results directory for any reason + // CopyFile(testApp, new DirectoryPath(resultsDir).CombineWithFilePath(new FilePath(testApp).GetFilename())); + } HandleTestResults(resultsDir, testsFailed, false); } diff --git a/eng/pipelines/common/device-tests-steps.yml b/eng/pipelines/common/device-tests-steps.yml index a9ac50cdeecb..c548b1d55419 100644 --- a/eng/pipelines/common/device-tests-steps.yml +++ b/eng/pipelines/common/device-tests-steps.yml @@ -88,20 +88,41 @@ steps: continueOnError: true timeoutInMinutes: 5 - - pwsh: | - ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} - displayName: $(Agent.JobName) - workingDirectory: ${{ parameters.checkoutDirectory }} - condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac')) - retryCountOnTaskFailure: 1 - - - bash: | - # Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited. - pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} - displayName: $(Agent.JobName) - workingDirectory: ${{ parameters.checkoutDirectory }} - condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac')) - retryCountOnTaskFailure: 1 + # Everything should be release but doing android for now to work around an xharness issue + - ${{ if eq(parameters.platform, 'android')}}: + - pwsh: | + ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} --configuration=${{ parameters.androidConfiguration }} + displayName: $(Agent.JobName) + workingDirectory: ${{ parameters.checkoutDirectory }} + condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac')) + retryCountOnTaskFailure: 1 + + - ${{ if eq(parameters.platform, 'android')}}: + - bash: | + # Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited. + pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} --configuration=${{ parameters.androidConfiguration }} + displayName: $(Agent.JobName) + workingDirectory: ${{ parameters.checkoutDirectory }} + condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac')) + retryCountOnTaskFailure: 1 + + - ${{ if ne(parameters.platform, 'android')}}: + - pwsh: | + ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} + displayName: $(Agent.JobName) + workingDirectory: ${{ parameters.checkoutDirectory }} + condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac')) + retryCountOnTaskFailure: 1 + + - ${{ if ne(parameters.platform, 'android')}}: + - bash: | + # Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited. + pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} + displayName: $(Agent.JobName) + workingDirectory: ${{ parameters.checkoutDirectory }} + condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac')) + retryCountOnTaskFailure: 1 + # Everything should be release but doing android for now to work around an xharness issue - ${{ if eq(parameters.platform, 'ios')}}: - bash: | @@ -128,4 +149,4 @@ steps: # This must always be placed as the last step in the job - template: agent-rebooter/mac.v1.yml@yaml-templates parameters: - AgentPoolAccessToken: ${{ parameters.agentPoolAccessToken }} + AgentPoolAccessToken: ${{ parameters.agentPoolAccessToken }} \ No newline at end of file diff --git a/eng/pipelines/common/device-tests.yml b/eng/pipelines/common/device-tests.yml index 62da938d0edc..0d49cf34d7a4 100644 --- a/eng/pipelines/common/device-tests.yml +++ b/eng/pipelines/common/device-tests.yml @@ -70,6 +70,7 @@ stages: checkoutDirectory: ${{ parameters.checkoutDirectory }} useArtifacts: ${{ parameters.useArtifacts }} poolName: ${{ parameters.androidPool.name }} + androidConfiguration: ${{ parameters.androidConfiguration }} - stage: ios_device_tests_${{ replace(parameters.targetFrameworkVersion.tfm, '.', '') }} displayName: ${{ parameters.targetFrameworkVersion.tfm }} iOS Device Tests diff --git a/eng/pipelines/device-tests.yml b/eng/pipelines/device-tests.yml index c1d50af2a72c..faf2e578d3f6 100644 --- a/eng/pipelines/device-tests.yml +++ b/eng/pipelines/device-tests.yml @@ -117,7 +117,7 @@ stages: windowsVersions: ['packaged', 'unpackaged'] provisionatorChannel: ${{ parameters.provisionatorChannel }} ${{ else }}: - androidApiLevels: [ 33 ] + androidApiLevels: [ 33, 23 ] iosVersions: [ 'simulator-17.2' ] catalystVersions: [ 'latest' ] windowsVersions: ['packaged', 'unpackaged'] @@ -126,6 +126,7 @@ stages: - name: essentials desc: Essentials androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable + androidConfiguration: 'Release' windowsPackageId: 'com.microsoft.maui.essentials.devicetests' android: $(System.DefaultWorkingDirectory)/src/Essentials/test/DeviceTests/Essentials.DeviceTests.csproj ios: $(System.DefaultWorkingDirectory)/src/Essentials/test/DeviceTests/Essentials.DeviceTests.csproj @@ -134,6 +135,7 @@ stages: - name: graphics desc: Graphics androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable + androidConfiguration: 'Release' windowsPackageId: 'com.microsoft.maui.graphics.devicetests' android: $(System.DefaultWorkingDirectory)/src/Graphics/tests/DeviceTests/Graphics.DeviceTests.csproj ios: $(System.DefaultWorkingDirectory)/src/Graphics/tests/DeviceTests/Graphics.DeviceTests.csproj @@ -142,6 +144,7 @@ stages: - name: core desc: Core androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable + androidConfiguration: 'Release' windowsPackageId: 'com.microsoft.maui.core.devicetests' android: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj ios: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj @@ -150,6 +153,7 @@ stages: - name: controls desc: Controls androidApiLevelsExclude: [27, 25] # Ignore for now API25 since the runs's are not stable + androidConfiguration: 'Debug' windowsPackageId: 'com.microsoft.maui.controls.devicetests' android: $(System.DefaultWorkingDirectory)/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj ios: $(System.DefaultWorkingDirectory)/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj @@ -158,6 +162,7 @@ stages: - name: blazorwebview desc: BlazorWebView androidApiLevelsExclude: [ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21 ] # BlazorWebView requires a recent version of Chrome + androidConfiguration: 'Release' windowsPackageId: 'Microsoft.Maui.MauiBlazorWebView.DeviceTests' android: $(System.DefaultWorkingDirectory)/src/BlazorWebView/tests/MauiDeviceTests/MauiBlazorWebView.DeviceTests.csproj ios: $(System.DefaultWorkingDirectory)/src/BlazorWebView/tests/MauiDeviceTests/MauiBlazorWebView.DeviceTests.csproj diff --git a/src/Core/tests/DeviceTests/Core.DeviceTests.csproj b/src/Core/tests/DeviceTests/Core.DeviceTests.csproj index 68b810f94a27..bda37d3efbf1 100644 --- a/src/Core/tests/DeviceTests/Core.DeviceTests.csproj +++ b/src/Core/tests/DeviceTests/Core.DeviceTests.csproj @@ -42,6 +42,11 @@ + + + 21.0 + + diff --git a/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.Android.cs b/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.Android.cs index c891dfeb126e..825a96c5ba56 100644 --- a/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.Android.cs +++ b/src/Core/tests/DeviceTests/Services/ImageSource/StreamImageSourceServiceTests.Android.cs @@ -22,6 +22,7 @@ public async Task ThrowsForIncorrectTypes(Type type) await Assert.ThrowsAsync(() => service.GetDrawableAsync(imageSource, MauiProgram.DefaultContext)); } +#if DEBUG [Theory] [InlineData("#FF0000")] [InlineData("#00FF00")] @@ -44,5 +45,6 @@ public async Task GetDrawableAsync(string colorHex) bitmap.AssertColorAtCenter(expectedColor); } +#endif } } \ No newline at end of file From d5caccd16ef314fb790f1c4f8d4239847692ac39 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Tue, 20 Aug 2024 11:48:16 -0500 Subject: [PATCH 2/5] - fix --- eng/pipelines/common/device-tests-steps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/common/device-tests-steps.yml b/eng/pipelines/common/device-tests-steps.yml index c548b1d55419..4ad1d9274801 100644 --- a/eng/pipelines/common/device-tests-steps.yml +++ b/eng/pipelines/common/device-tests-steps.yml @@ -4,6 +4,7 @@ parameters: device: '' # the xharness device to use apiversion: '' # the iOS device api version to use cakeArgs: '' # additional cake args + androidConfiguration: '' # Indicates the configuration to use for Android. We're slowly enabling this for all projects provisionatorChannel: 'latest' agentPoolAccessToken: '' artifactName: 'nuget' From 6dc213620b55a6a9811185eeec6f5467230fcb05 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Tue, 20 Aug 2024 12:15:31 -0500 Subject: [PATCH 3/5] - options --- eng/pipelines/common/device-tests-steps.yml | 2 +- eng/pipelines/common/device-tests.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/common/device-tests-steps.yml b/eng/pipelines/common/device-tests-steps.yml index 4ad1d9274801..2e278760b390 100644 --- a/eng/pipelines/common/device-tests-steps.yml +++ b/eng/pipelines/common/device-tests-steps.yml @@ -4,7 +4,7 @@ parameters: device: '' # the xharness device to use apiversion: '' # the iOS device api version to use cakeArgs: '' # additional cake args - androidConfiguration: '' # Indicates the configuration to use for Android. We're slowly enabling this for all projects + androidConfiguration: 'debug' # Indicates the configuration to use for Android. We're slowly enabling this for all projects provisionatorChannel: 'latest' agentPoolAccessToken: '' artifactName: 'nuget' diff --git a/eng/pipelines/common/device-tests.yml b/eng/pipelines/common/device-tests.yml index 0d49cf34d7a4..fe60657dfd21 100644 --- a/eng/pipelines/common/device-tests.yml +++ b/eng/pipelines/common/device-tests.yml @@ -12,6 +12,7 @@ parameters: artifactName: 'nuget' artifactItemPattern: '**/*.nupkg' checkoutDirectory: $(System.DefaultWorkingDirectory) + androidConfiguration: 'debug' # Indicates the configuration to use for Android. We're slowly enabling this for all projects useArtifacts: false targetFrameworkVersion: - tfm: '' From dde4e06b87da6ffcf9053f29dbd17f54cbd5c7ed Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Tue, 20 Aug 2024 12:44:27 -0500 Subject: [PATCH 4/5] Update device-tests-steps.yml --- eng/pipelines/common/device-tests-steps.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/common/device-tests-steps.yml b/eng/pipelines/common/device-tests-steps.yml index 2e278760b390..b37bc5e3bd01 100644 --- a/eng/pipelines/common/device-tests-steps.yml +++ b/eng/pipelines/common/device-tests-steps.yml @@ -4,7 +4,7 @@ parameters: device: '' # the xharness device to use apiversion: '' # the iOS device api version to use cakeArgs: '' # additional cake args - androidConfiguration: 'debug' # Indicates the configuration to use for Android. We're slowly enabling this for all projects + androidConfiguration: '' # Indicates the configuration to use for Android. We're slowly enabling this for all projects provisionatorChannel: 'latest' agentPoolAccessToken: '' artifactName: 'nuget' @@ -150,4 +150,4 @@ steps: # This must always be placed as the last step in the job - template: agent-rebooter/mac.v1.yml@yaml-templates parameters: - AgentPoolAccessToken: ${{ parameters.agentPoolAccessToken }} \ No newline at end of file + AgentPoolAccessToken: ${{ parameters.agentPoolAccessToken }} From bcb12426f6c76e2f57d35c5c3aa479036f7de125 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Tue, 20 Aug 2024 13:36:16 -0500 Subject: [PATCH 5/5] - try me --- eng/pipelines/common/device-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/common/device-tests.yml b/eng/pipelines/common/device-tests.yml index fe60657dfd21..1bac43fff791 100644 --- a/eng/pipelines/common/device-tests.yml +++ b/eng/pipelines/common/device-tests.yml @@ -49,6 +49,7 @@ stages: ${{ replace(coalesce(project.desc, project.name), ' ', '_') }}_API_${{ api }}: REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE) PROJECT_PATH: ${{ project.android }} + ANDROID_CONFIGURATION: ${{ project.androidConfiguration }} TARGET_FRAMEWORK_VERSION: ${{ parameters.targetFrameworkVersion.tfm }} ${{ if eq(api, 27) }}: DEVICE: android-emulator-32_${{ api }} @@ -71,7 +72,7 @@ stages: checkoutDirectory: ${{ parameters.checkoutDirectory }} useArtifacts: ${{ parameters.useArtifacts }} poolName: ${{ parameters.androidPool.name }} - androidConfiguration: ${{ parameters.androidConfiguration }} + androidConfiguration: $(ANDROID_CONFIGURATION) - stage: ios_device_tests_${{ replace(parameters.targetFrameworkVersion.tfm, '.', '') }} displayName: ${{ parameters.targetFrameworkVersion.tfm }} iOS Device Tests