1111 init-type :
1212 required : true
1313 type : string
14- # Map the workflow outputs to job outputs
15- outputs :
16- status :
17- description : " Integration test status"
18- value : ${{ jobs.run.outputs.status }}
1914
2015defaults :
2116 run :
@@ -24,15 +19,14 @@ defaults:
2419jobs :
2520 run :
2621 name : ${{ inputs.unity-version }} ${{ inputs.api-level }} ${{ inputs.init-type }}
27- runs-on : ubuntu-latest
22+ # Unity 6000.x builds ARM64 so we run Redroid (containerized arm64 Android) on an
23+ # arm64 Linux runner.
24+ runs-on : ${{ fromJSON(inputs.unity-version) >= 6000 && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
2825 env :
2926 ARTIFACTS_PATH : samples/IntegrationTest/test-artifacts/
3027 HOMEBREW_NO_INSTALL_CLEANUP : 1
3128 SENTRY_DSN : ${{ secrets.SENTRY_TEST_DSN }}
3229 SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
33- # Map the job outputs to step outputs
34- outputs :
35- status : ${{ steps.integration-test.outputs.status }}
3630
3731 steps :
3832 - name : Checkout
@@ -48,28 +42,45 @@ jobs:
4842 name : testapp-android-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }}
4943 path : samples/IntegrationTest/Build
5044
45+ - name : Determine device
46+ id : device
47+ run : |
48+ if ([double]"${{ inputs.unity-version }}" -ge 6000) {
49+ $device = "redroid"; $arch = "arm64-v8a"
50+ } else {
51+ $device = "emulator"; $arch = "x86_64"
52+ }
53+ "device=$device" >> $env:GITHUB_OUTPUT
54+ "arch=$arch" >> $env:GITHUB_OUTPUT
55+ Write-Host "Using device: $device ($arch)"
56+
57+ # --- x86_64 path: hardware-accelerated emulator on the x86 Linux runner ---
58+
59+ - name : Add Android build-tools to PATH
60+ if : ${{ steps.device.outputs.device == 'emulator' }}
61+ run : |
62+ $buildToolsDir = (Get-ChildItem "$env:ANDROID_HOME/build-tools" -Directory | Sort-Object { [version]$_.Name } | Select-Object -Last 1).FullName
63+ Write-Host "Found build-tools at: $buildToolsDir"
64+ $buildToolsDir >> $env:GITHUB_PATH
65+
5166 # See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
5267 - name : Enable KVM group perms
68+ if : ${{ steps.device.outputs.device == 'emulator' }}
5369 run : |
5470 echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
5571 sudo udevadm control --reload-rules
5672 sudo udevadm trigger --name-match=kvm
5773
5874 # Make sure that the required directories and .cfg do exists. Workaround to keep ADV happy on `ubuntu-latest`.
5975 - name : Setup Android directories
76+ if : ${{ steps.device.outputs.device == 'emulator' }}
6077 run : |
6178 mkdir -p $HOME/.android
6279 mkdir -p $HOME/.android/avd
6380 touch $HOME/.android/repositories.cfg
6481
65- - name : Add Android build-tools to PATH
66- run : |
67- BUILD_TOOLS_DIR=$(ls -d $ANDROID_HOME/build-tools/*/ | sort -V | tail -1)
68- echo "Found build-tools at: $BUILD_TOOLS_DIR"
69- echo "$BUILD_TOOLS_DIR" >> $GITHUB_PATH
70- shell : bash
71-
72- - name : Run Android Integration Tests
82+ - name : Run Android Integration Tests (emulator)
83+ if : ${{ steps.device.outputs.device == 'emulator' }}
7384 uses : reactivecircus/android-emulator-runner@0a638108440efd5c7f980e6ba145dbcdd8f32009 # v2.37.0
7485 id : integration-test
7586 timeout-minutes : 30
@@ -90,13 +101,72 @@ jobs:
90101 -camera-front none
91102 -timezone US/Pacific
92103 -no-metrics
93- arch : x86_64
104+ arch : ${{ steps.device.outputs.arch }}
94105 script : |
95106 adb wait-for-device
96107 adb shell input keyevent 82
97108 adb devices -l
98109 pwsh -Command '$env:SENTRY_TEST_PLATFORM = "Android"; $env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.apk"; Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI'
99110
111+ # --- arm64 path: Redroid container on the arm64 runner (no hypervisor needed) ---
112+
113+ - name : Start Redroid container
114+ if : ${{ steps.device.outputs.device == 'redroid' }}
115+ run : |
116+ $ErrorActionPreference = "Stop"
117+ $PSNativeCommandUseErrorActionPreference = $true
118+ $kernel = uname -r
119+ sudo apt-get update
120+ sudo apt-get install -y adb aapt "linux-modules-extra-$kernel"
121+ sudo modprobe binder_linux devices="binder,hwbinder,vndbinder"
122+ $PSNativeCommandUseErrorActionPreference = $false
123+ sudo modprobe ashmem_linux # built into the kernel on newer releases; ignore if absent
124+ $PSNativeCommandUseErrorActionPreference = $true
125+ $hasBinder = (Test-Path /dev/binderfs) -or
126+ (Select-String -Path /proc/filesystems -Pattern '\bbinder\b' -Quiet) -or
127+ (Test-Path /dev/binder)
128+ if (-not $hasBinder) {
129+ Write-Error "binder is unavailable on this kernel ($kernel); Redroid cannot run."
130+ exit 1
131+ }
132+ docker run -d --rm --privileged `
133+ --name redroid `
134+ -p 5555:5555 `
135+ redroid/redroid:13.0.0_64only-latest `
136+ androidboot.redroid_gpu_mode=guest
137+
138+ - name : Run Android Integration Tests (redroid)
139+ if : ${{ steps.device.outputs.device == 'redroid' }}
140+ id : integration-test-redroid
141+ timeout-minutes : 30
142+ env :
143+ # adb auto-detects Redroid both on the emulator console port (emulator-5554) and via our
144+ # `adb connect` (localhost:5555). Pin a single serial so bare `adb` commands in the test
145+ # (e.g. the launcher-activity dumpsys) don't fail/misfire with "more than one device".
146+ ANDROID_SERIAL : localhost:5555
147+ run : |
148+ $ErrorActionPreference = "Stop"
149+ # adbd inside Redroid takes a while to come up. `adb connect` reports success even when the
150+ # port isn't serving yet and the transport stays 'offline', so poll connect + boot state
151+ # together instead of relying on `adb wait-for-device`.
152+ for ($i = 1; $i -le 60; $i++) {
153+ adb connect localhost:5555 *> $null
154+ $booted = (adb -s localhost:5555 shell getprop sys.boot_completed 2>$null | Out-String).Trim()
155+ if ($booted -eq "1") { Write-Host "Redroid booted after $($i * 5)s"; break }
156+ if ($i -eq 60) {
157+ Write-Host "Redroid did not boot in time"
158+ adb devices -l
159+ docker logs redroid 2>&1 | Select-Object -Last 80
160+ adb -s localhost:5555 logcat -d 2>&1 | Select-Object -Last 100
161+ exit 1
162+ }
163+ Start-Sleep -Seconds 5
164+ }
165+ adb devices -l
166+ $env:SENTRY_TEST_PLATFORM = "Android"
167+ $env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.apk"
168+ Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
169+
100170 - name : Upload test results on failure
101171 if : ${{ failure() }}
102172 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
0 commit comments