Skip to content

Commit 6ea6bf4

Browse files
authored
ci: retry flaky android device tests (#4553)
1 parent e7cfea6 commit 6ea6bf4

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

.github/workflows/device-tests-android.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
pull_request:
99
paths-ignore:
1010
- "**.md"
11+
workflow_dispatch:
1112

1213
jobs:
1314
build:
@@ -64,6 +65,12 @@ jobs:
6465
env:
6566
DOTNET_CLI_TELEMETRY_OPTOUT: 1
6667
DOTNET_NOLOGO: 1
68+
# We don't need the Google APIs, but the default images are not available for 32+
69+
ANDROID_EMULATOR_TARGET: google_apis
70+
ANDROID_EMULATOR_RAM_SIZE: 2048M
71+
ANDROID_EMULATOR_ARCH: x86_64
72+
ANDROID_EMULATOR_DISK_SIZE: 4096M
73+
ANDROID_EMULATOR_OPTIONS: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
6774
steps:
6875
# See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
6976
- name: Enable KVM group perms
@@ -87,17 +94,33 @@ jobs:
8794
# Cached AVD setup per https://github.com/ReactiveCircus/android-emulator-runner/blob/main/README.md
8895

8996
- name: Run Tests
97+
id: first-run
98+
continue-on-error: true
9099
timeout-minutes: 40
91100
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # Tag: v2.34.0
92101
with:
93102
api-level: ${{ matrix.api-level }}
94-
# We don't need the Google APIs, but the default images are not available for 32+
95-
target: google_apis
103+
target: ${{ env.ANDROID_EMULATOR_TARGET }}
96104
force-avd-creation: false
97-
ram-size: 2048M
98-
arch: x86_64
99-
disk-size: 4096M
100-
emulator-options: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
105+
ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
106+
arch: ${{ env.ANDROID_EMULATOR_ARCH }}
107+
disk-size: ${{ env.ANDROID_EMULATOR_DISK_SIZE }}
108+
emulator-options: ${{ env.ANDROID_EMULATOR_OPTIONS }}
109+
disable-animations: false
110+
script: pwsh scripts/device-test.ps1 android -Run -Tfm ${{ matrix.tfm }}
111+
112+
- name: Retry Tests (if previous failed to run)
113+
if: steps.first-run.outcome == 'failure'
114+
timeout-minutes: 40
115+
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # Tag: v2.34.0
116+
with:
117+
api-level: ${{ matrix.api-level }}
118+
target: ${{ env.ANDROID_EMULATOR_TARGET }}
119+
force-avd-creation: false
120+
ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }}
121+
arch: ${{ env.ANDROID_EMULATOR_ARCH }}
122+
disk-size: ${{ env.ANDROID_EMULATOR_DISK_SIZE }}
123+
emulator-options: ${{ env.ANDROID_EMULATOR_OPTIONS }}
101124
disable-animations: false
102125
script: pwsh scripts/device-test.ps1 android -Run -Tfm ${{ matrix.tfm }}
103126

.github/workflows/device-tests-ios.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
pull_request:
99
paths-ignore:
1010
- "**.md"
11+
workflow_dispatch:
1112

1213
jobs:
1314
ios-tests:

scripts/device-test.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ try
8686
{
8787
if (!(Get-Command xharness -ErrorAction SilentlyContinue))
8888
{
89-
Push-Location ($CI ? $env:RUNNER_TEMP : $IsWindows ? $env:TMP : $IsMacos ? $env:TMPDIR : '/temp')
90-
dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version '10.0.0-prerelease.25412.1' `
89+
Push-Location ($CI ? $env:RUNNER_TEMP : $IsWindows ? $env:TMP : $IsMacos ? $env:TMPDIR : '/tmp')
90+
dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version '10.0.0-prerelease.25466.1' `
9191
--add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json
9292
Pop-Location
9393
}

0 commit comments

Comments
 (0)