Skip to content

Commit 2824606

Browse files
committed
Run Android device tests on macOS HVF emulator
1 parent 7c0309e commit 2824606

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

.github/workflows/scripts-android.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
android-device-tests:
4040
needs: build-android
41-
runs-on: ubuntu-22.04-arm
41+
runs-on: macos-14
4242
steps:
4343
- name: Checkout repository
4444
uses: actions/checkout@v4
@@ -55,12 +55,36 @@ jobs:
5555
accept-android-sdk-licenses: false
5656
packages: ''
5757

58-
- name: Install adb for ARM environment
58+
- name: Install Android platform tools
5959
shell: bash
6060
run: |
6161
set -euxo pipefail
62-
sudo apt-get update -y
63-
sudo apt-get install -y adb
62+
if ! command -v sdkmanager >/dev/null 2>&1; then
63+
echo "sdkmanager executable is required" >&2
64+
exit 1
65+
fi
66+
67+
SDKMANAGER="$(command -v sdkmanager)"
68+
69+
run_sdk() {
70+
set +o pipefail
71+
yes | "$SDKMANAGER" "$@" >/dev/null 2>&1
72+
local rc=${PIPESTATUS[1]}
73+
set -o pipefail
74+
return $rc
75+
}
76+
77+
run_sdk --licenses
78+
run_sdk --install "platform-tools" "build-tools;34.0.0"
79+
run_sdk --install "platforms;android-33" || echo "Warning: failed to install Android 33 platform" >&2
80+
81+
if [ -n "${ANDROID_HOME:-}" ] && [ -d "${ANDROID_HOME}/platform-tools" ]; then
82+
echo "${ANDROID_HOME}/platform-tools" >> "$GITHUB_PATH"
83+
fi
84+
if [ -n "${ANDROID_SDK_ROOT:-}" ] && [ -d "${ANDROID_SDK_ROOT}/platform-tools" ]; then
85+
echo "${ANDROID_SDK_ROOT}/platform-tools" >> "$GITHUB_PATH"
86+
fi
87+
6488
command -v adb
6589
adb version
6690
@@ -116,6 +140,12 @@ jobs:
116140
else
117141
adb exec-out screencap -p > screenshots/test-suite.png
118142
fi
143+
target: default
144+
cores: 2
145+
avd-name: test
146+
force-avd-creation: true
147+
emulator-boot-timeout: 600
148+
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -accel hvf
119149
- name: Upload emulator screenshots
120150
uses: actions/upload-artifact@v4
121151
with:

0 commit comments

Comments
 (0)