Skip to content

Commit

Permalink
fix: Android device tests (#1936)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes authored Dec 20, 2024
1 parent b7e5b14 commit d1229d1
Show file tree
Hide file tree
Showing 7 changed files with 318 additions and 348 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/android-smoke-test-wrapper.yml

This file was deleted.

49 changes: 26 additions & 23 deletions .github/workflows/android-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ on:
api-level:
required: true
type: string
try:
required: true
type: number
# Map the workflow outputs to job outputs
outputs:
outcome:
description:
value: ${{ jobs.run.outputs.outcome }}
status:
description: "Smoke test status"
value: ${{ jobs.run.outputs.status }}

jobs:
run:
name: try-${{ inputs.try }}
runs-on: macos-latest
name: Android Smoke Test
runs-on: ubuntu-latest
env:
ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand All @@ -28,17 +25,24 @@ jobs:
shell: pwsh
# Map the job outputs to step outputs
outputs:
outcome: ${{ steps.smoke-test.outcome }}
status: ${{ steps.smoke-test.outputs.status }}
steps:
- name: Checkout
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Download test app artifact
uses: actions/download-artifact@v4
with:
name: testapp-Android-compiled-${{ inputs.unity-version }}
path: samples/IntegrationTest/Build

# 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
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
# outputs variables: api-level, label, target
- name: Configure Android Settings
id: config
Expand All @@ -64,24 +68,23 @@ jobs:
"target=$target" >> $env:GITHUB_OUTPUT
"api-level=$apiLevel" >> $env:GITHUB_OUTPUT
"label=$($label ?? $apiLevel)" >> $env:GITHUB_OUTPUT
- name: Android API ${{ steps.config.outputs.label }} emulator setup + Smoke test
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # pin@v2.28.0
- name: Run Android Smoke Tests
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # pin@v2.33.0
id: smoke-test
timeout-minutes: 40
continue-on-error: true
timeout-minutes: 30
with:
api-level: ${{ steps.config.outputs.api-level }}
target: ${{ steps.config.outputs.target }}
force-avd-creation: false
ram-size: 2048M
arch: x86_64
cores: 3
emulator-boot-timeout: 1800
disk-size: 4096M # Some runs have out of storage error when installing the smoke test.
emulator-options: -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -accel on
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: pwsh ./scripts/smoke-test-android.ps1 -IsIntegrationTest -WarnIfFlaky
arch: x86_64
script: |
adb wait-for-device
adb shell input keyevent 82
adb devices -l
pwsh ./scripts/smoke-test-android.ps1 -IsIntegrationTest -WarnIfFlaky
- name: Upload artifacts on failure
if: ${{ failure() }}
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,26 +470,15 @@ jobs:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [mobile-smoke-test-compile]
name: ${{ matrix.unity-version }} Android ${{ matrix.api-level }} Run Smoke Test
uses: ./.github/workflows/android-smoke-test-wrapper.yml
uses: ./.github/workflows/android-smoke-test.yml
with:
unity-version: ${{ matrix.unity-version }}
api-level: ${{ matrix.api-level }}
strategy:
fail-fast: false
matrix:
api-level: [27, 28, 29, 30, 31] # last updated October 2022
api-level: [27, 31, 34] # last updated December 2024
unity-version: ["2019", "2022", "6000"]
include:
# API 21 is barely used but let's check it as the minimum supported version for now.
- api-level: 21
unity-version: "2019"
exclude:
# Seems like there's an error in Unity with Android API 30 - disabling.
# https://github.com/getsentry/sentry-unity/issues/719#issuecomment-1129129952
- api-level: 30
unity-version: "2021"
- api-level: 30
unity-version: "2022"

mobile-smoke-test-compile:
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
Expand Down
Loading

0 comments on commit d1229d1

Please sign in to comment.