Skip to content

Commit 997a8cf

Browse files
committed
added 6.5 to CI, updated android integration test runner to handle ARM64
1 parent 1942c34 commit 997a8cf

6 files changed

Lines changed: 98 additions & 16 deletions

File tree

.github/workflows/create-unity-matrix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ on:
1414

1515
env:
1616
# Unity versions used in PRs
17-
PR_UNITY_VERSIONS: '["2022.3", "6000.0", "6000.3"]'
17+
PR_UNITY_VERSIONS: '["2022.3", "6000.3", "6000.5"]'
1818
# Unity versions used on main branch
19-
FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3"]'
19+
FULL_UNITY_VERSIONS: '["2021.3", "2022.3", "6000.0", "6000.3", "6000.5"]'
2020

2121
jobs:
2222
create-unity-matrix:

.github/workflows/test-build-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
"unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT
3131
3232
- name: Setup Unity
33-
uses: getsentry/setup-unity@1bbd385ae3b0505069aacc56d47f0a16366f10b1
33+
uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3
3434
with:
3535
unity-version: ${{ steps.env.outputs.unityVersion }}
3636
unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}

.github/workflows/test-build-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
"unityChangeset=$($u.changeset)" >> $env:GITHUB_OUTPUT
3131
3232
- name: Setup Unity
33-
uses: getsentry/setup-unity@1bbd385ae3b0505069aacc56d47f0a16366f10b1
33+
uses: getsentry/setup-unity@61c0c0944851685b6c1225e940d1b1ab349e3aa3
3434
with:
3535
unity-version: ${{ steps.env.outputs.unityVersion }}
3636
unity-version-changeset: ${{ steps.env.outputs.unityChangeset }}

.github/workflows/test-run-android.yml

Lines changed: 87 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ defaults:
2424
jobs:
2525
run:
2626
name: ${{ inputs.unity-version }} ${{ inputs.api-level }} ${{ inputs.init-type }}
27-
runs-on: ubuntu-latest
27+
# Unity 6000.x builds ARM64 so we run Redroid (containerized arm64 Android) on an
28+
# arm64 Linux runner.
29+
runs-on: ${{ fromJSON(inputs.unity-version) >= 6000 && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
2830
env:
2931
ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/
3032
HOMEBREW_NO_INSTALL_CLEANUP: 1
@@ -48,28 +50,45 @@ jobs:
4850
name: testapp-android-compiled-${{ inputs.unity-version }}-${{ inputs.init-type }}
4951
path: samples/IntegrationTest/Build
5052

53+
- name: Determine device
54+
id: device
55+
run: |
56+
if ([double]"${{ inputs.unity-version }}" -ge 6000) {
57+
$device = "redroid"; $arch = "arm64-v8a"
58+
} else {
59+
$device = "emulator"; $arch = "x86_64"
60+
}
61+
"device=$device" >> $env:GITHUB_OUTPUT
62+
"arch=$arch" >> $env:GITHUB_OUTPUT
63+
Write-Host "Using device: $device ($arch)"
64+
65+
# --- x86_64 path: hardware-accelerated emulator on the x86 Linux runner ---
66+
67+
- name: Add Android build-tools to PATH
68+
if: ${{ steps.device.outputs.device == 'emulator' }}
69+
run: |
70+
$buildToolsDir = (Get-ChildItem "$env:ANDROID_HOME/build-tools" -Directory | Sort-Object Name | Select-Object -Last 1).FullName
71+
Write-Host "Found build-tools at: $buildToolsDir"
72+
$buildToolsDir >> $env:GITHUB_PATH
73+
5174
# See https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
5275
- name: Enable KVM group perms
76+
if: ${{ steps.device.outputs.device == 'emulator' }}
5377
run: |
5478
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
5579
sudo udevadm control --reload-rules
5680
sudo udevadm trigger --name-match=kvm
5781
5882
# Make sure that the required directories and .cfg do exists. Workaround to keep ADV happy on `ubuntu-latest`.
5983
- name: Setup Android directories
84+
if: ${{ steps.device.outputs.device == 'emulator' }}
6085
run: |
6186
mkdir -p $HOME/.android
6287
mkdir -p $HOME/.android/avd
6388
touch $HOME/.android/repositories.cfg
6489
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
90+
- name: Run Android Integration Tests (emulator)
91+
if: ${{ steps.device.outputs.device == 'emulator' }}
7392
uses: reactivecircus/android-emulator-runner@0a638108440efd5c7f980e6ba145dbcdd8f32009 # v2.37.0
7493
id: integration-test
7594
timeout-minutes: 30
@@ -90,13 +109,71 @@ jobs:
90109
-camera-front none
91110
-timezone US/Pacific
92111
-no-metrics
93-
arch: x86_64
112+
arch: ${{ steps.device.outputs.arch }}
94113
script: |
95114
adb wait-for-device
96115
adb shell input keyevent 82
97116
adb devices -l
98117
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'
99118
119+
# --- arm64 path: Redroid container on the arm64 runner (no hypervisor needed) ---
120+
121+
- name: Start Redroid container
122+
if: ${{ steps.device.outputs.device == 'redroid' }}
123+
run: |
124+
$ErrorActionPreference = "Stop"
125+
$PSNativeCommandUseErrorActionPreference = $true
126+
$kernel = uname -r
127+
sudo apt-get update
128+
sudo apt-get install -y adb aapt "linux-modules-extra-$kernel"
129+
sudo modprobe binder_linux devices="binder,hwbinder,vndbinder"
130+
$PSNativeCommandUseErrorActionPreference = $false
131+
sudo modprobe ashmem_linux # built into the kernel on newer releases; ignore if absent
132+
$hasBinder = (Test-Path /dev/binderfs) -or
133+
(Select-String -Path /proc/filesystems -Pattern '\bbinder\b' -Quiet) -or
134+
(Test-Path /dev/binder)
135+
if (-not $hasBinder) {
136+
Write-Error "binder is unavailable on this kernel ($kernel); Redroid cannot run."
137+
exit 1
138+
}
139+
docker run -d --rm --privileged `
140+
--name redroid `
141+
-p 5555:5555 `
142+
redroid/redroid:13.0.0_64only-latest `
143+
androidboot.redroid_gpu_mode=guest
144+
145+
- name: Run Android Integration Tests (redroid)
146+
if: ${{ steps.device.outputs.device == 'redroid' }}
147+
id: integration-test-redroid
148+
timeout-minutes: 30
149+
env:
150+
# adb auto-detects Redroid both on the emulator console port (emulator-5554) and via our
151+
# `adb connect` (localhost:5555). Pin a single serial so bare `adb` commands in the test
152+
# (e.g. the launcher-activity dumpsys) don't fail/misfire with "more than one device".
153+
ANDROID_SERIAL: localhost:5555
154+
run: |
155+
$ErrorActionPreference = "Stop"
156+
# adbd inside Redroid takes a while to come up. `adb connect` reports success even when the
157+
# port isn't serving yet and the transport stays 'offline', so poll connect + boot state
158+
# together instead of relying on `adb wait-for-device`.
159+
for ($i = 1; $i -le 60; $i++) {
160+
adb connect localhost:5555 *> $null
161+
$booted = (adb -s localhost:5555 shell getprop sys.boot_completed 2>$null | Out-String).Trim()
162+
if ($booted -eq "1") { Write-Host "Redroid booted after $($i * 5)s"; break }
163+
if ($i -eq 60) {
164+
Write-Host "Redroid did not boot in time"
165+
adb devices -l
166+
docker logs redroid 2>&1 | Select-Object -Last 80
167+
adb -s localhost:5555 logcat -d 2>&1 | Select-Object -Last 100
168+
exit 1
169+
}
170+
Start-Sleep -Seconds 5
171+
}
172+
adb devices -l
173+
$env:SENTRY_TEST_PLATFORM = "Android"
174+
$env:SENTRY_TEST_APP = "samples/IntegrationTest/Build/test.apk"
175+
Invoke-Pester -Path test/IntegrationTest/Integration.Tests.ps1 -CI
176+
100177
- name: Upload test results on failure
101178
if: ${{ failure() }}
102179
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

scripts/unity-versions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@
1414
"6000.3": {
1515
"version": "6000.3.18f1",
1616
"changeset": "5ebeb53e4c07"
17+
},
18+
"6000.5": {
19+
"version": "6000.5.0f1",
20+
"changeset": "88b47c5e7076"
1721
}
1822
}

test/Scripts.Integration.Test/Editor/Builder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ public static void BuildIl2CPPPlayer(BuildTarget target, BuildTargetGroup group,
8080
PlayerSettings.Android.minifyDebug = PlayerSettings.Android.minifyRelease = true;
8181

8282
#if UNITY_6000_0_OR_NEWER
83-
Debug.Log("Builder: Setting target architectures");
84-
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.All;
83+
// X86_64 has been deprecated and was removed with 6.5
84+
Debug.Log("Builder: Setting target architecture to ARM64");
85+
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
8586
#endif
8687
}
8788

0 commit comments

Comments
 (0)