diff --git a/.github/workflows/device-tests-android.yml b/.github/workflows/device-tests-android.yml index b97936f3e2..b234d39df2 100644 --- a/.github/workflows/device-tests-android.yml +++ b/.github/workflows/device-tests-android.yml @@ -8,6 +8,7 @@ on: pull_request: paths-ignore: - "**.md" + workflow_dispatch: jobs: build: @@ -64,6 +65,12 @@ jobs: env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 + # We don't need the Google APIs, but the default images are not available for 32+ + ANDROID_EMULATOR_TARGET: google_apis + ANDROID_EMULATOR_RAM_SIZE: 2048M + ANDROID_EMULATOR_ARCH: x86_64 + ANDROID_EMULATOR_DISK_SIZE: 4096M + ANDROID_EMULATOR_OPTIONS: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none steps: # See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ - name: Enable KVM group perms @@ -87,17 +94,33 @@ jobs: # Cached AVD setup per https://github.com/ReactiveCircus/android-emulator-runner/blob/main/README.md - name: Run Tests + id: first-run + continue-on-error: true timeout-minutes: 40 uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # Tag: v2.34.0 with: api-level: ${{ matrix.api-level }} - # We don't need the Google APIs, but the default images are not available for 32+ - target: google_apis + target: ${{ env.ANDROID_EMULATOR_TARGET }} force-avd-creation: false - ram-size: 2048M - arch: x86_64 - disk-size: 4096M - emulator-options: -no-snapshot-save -no-window -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }} + arch: ${{ env.ANDROID_EMULATOR_ARCH }} + disk-size: ${{ env.ANDROID_EMULATOR_DISK_SIZE }} + emulator-options: ${{ env.ANDROID_EMULATOR_OPTIONS }} + disable-animations: false + script: pwsh scripts/device-test.ps1 android -Run -Tfm ${{ matrix.tfm }} + + - name: Retry Tests (if previous failed to run) + if: steps.first-run.outcome == 'failure' + timeout-minutes: 40 + uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # Tag: v2.34.0 + with: + api-level: ${{ matrix.api-level }} + target: ${{ env.ANDROID_EMULATOR_TARGET }} + force-avd-creation: false + ram-size: ${{ env.ANDROID_EMULATOR_RAM_SIZE }} + arch: ${{ env.ANDROID_EMULATOR_ARCH }} + disk-size: ${{ env.ANDROID_EMULATOR_DISK_SIZE }} + emulator-options: ${{ env.ANDROID_EMULATOR_OPTIONS }} disable-animations: false script: pwsh scripts/device-test.ps1 android -Run -Tfm ${{ matrix.tfm }} diff --git a/.github/workflows/device-tests-ios.yml b/.github/workflows/device-tests-ios.yml index c56226bdb6..0e118745cc 100644 --- a/.github/workflows/device-tests-ios.yml +++ b/.github/workflows/device-tests-ios.yml @@ -8,6 +8,7 @@ on: pull_request: paths-ignore: - "**.md" + workflow_dispatch: jobs: ios-tests: diff --git a/scripts/device-test.ps1 b/scripts/device-test.ps1 index 7822b81582..f9d5c30868 100644 --- a/scripts/device-test.ps1 +++ b/scripts/device-test.ps1 @@ -86,8 +86,8 @@ try { if (!(Get-Command xharness -ErrorAction SilentlyContinue)) { - Push-Location ($CI ? $env:RUNNER_TEMP : $IsWindows ? $env:TMP : $IsMacos ? $env:TMPDIR : '/temp') - dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version '10.0.0-prerelease.25412.1' ` + Push-Location ($CI ? $env:RUNNER_TEMP : $IsWindows ? $env:TMP : $IsMacos ? $env:TMPDIR : '/tmp') + dotnet tool install Microsoft.DotNet.XHarness.CLI --global --version '10.0.0-prerelease.25466.1' ` --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json Pop-Location }