Provision Android emulator without external action
This commit is contained in:
@@ -24,6 +24,7 @@ stop_pid_file() {
|
|||||||
|
|
||||||
stop_pid_file "$artifact_dir/metro.pid"
|
stop_pid_file "$artifact_dir/metro.pid"
|
||||||
stop_pid_file "$artifact_dir/mock-server.pid"
|
stop_pid_file "$artifact_dir/mock-server.pid"
|
||||||
|
stop_pid_file "$artifact_dir/emulator.pid"
|
||||||
|
|
||||||
if [[ "$platform" == "ios" ]]; then
|
if [[ "$platform" == "ios" ]]; then
|
||||||
if [[ -f "$artifact_dir/redis-bin.txt" ]]; then
|
if [[ -f "$artifact_dir/redis-bin.txt" ]]; then
|
||||||
|
|||||||
@@ -168,18 +168,62 @@ jobs:
|
|||||||
"$RUNNER_TEMP/maestro/bin/maestro" --version | tee artifacts/android/maestro-version.log
|
"$RUNNER_TEMP/maestro/bin/maestro" --version | tee artifacts/android/maestro-version.log
|
||||||
test "$("$RUNNER_TEMP/maestro/bin/maestro" --version)" = "$MAESTRO_VERSION"
|
test "$("$RUNNER_TEMP/maestro/bin/maestro" --version)" = "$MAESTRO_VERSION"
|
||||||
|
|
||||||
- name: Boot one Android emulator and run Maestro suite
|
- name: Install and boot one Android emulator
|
||||||
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
|
run: |
|
||||||
with:
|
echo "Booting Android emulator" > artifacts/android/phase.txt
|
||||||
api-level: 35
|
android_sdk="${ANDROID_SDK_ROOT:-${ANDROID_HOME:?ANDROID_HOME is not set}}"
|
||||||
target: google_apis
|
sdkmanager_bin=$(command -v sdkmanager)
|
||||||
arch: x86_64
|
avdmanager_bin=$(command -v avdmanager)
|
||||||
profile: pixel_6
|
system_image="system-images;android-35;google_apis;x86_64"
|
||||||
avd-name: nightly-e2e
|
|
||||||
emulator-port: 5554
|
yes | "$sdkmanager_bin" --sdk_root="$android_sdk" --licenses >/dev/null || true
|
||||||
disable-animations: true
|
"$sdkmanager_bin" --sdk_root="$android_sdk" \
|
||||||
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
|
"platform-tools" "emulator" "$system_image"
|
||||||
script: .github/scripts/run-nightly-e2e.sh android emulator-5554
|
|
||||||
|
export ANDROID_AVD_HOME="$RUNNER_TEMP/.android/avd"
|
||||||
|
mkdir -p "$ANDROID_AVD_HOME"
|
||||||
|
echo "ANDROID_AVD_HOME=$ANDROID_AVD_HOME" >> "$GITHUB_ENV"
|
||||||
|
echo no | "$avdmanager_bin" create avd \
|
||||||
|
--force \
|
||||||
|
--name nightly-e2e \
|
||||||
|
--package "$system_image" \
|
||||||
|
--device pixel_6
|
||||||
|
|
||||||
|
if [ -e /dev/kvm ] && [ ! -w /dev/kvm ]; then
|
||||||
|
sudo chmod 666 /dev/kvm
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$android_sdk/emulator/emulator" @nightly-e2e \
|
||||||
|
-port 5554 \
|
||||||
|
-no-window \
|
||||||
|
-gpu swiftshader_indirect \
|
||||||
|
-no-snapshot \
|
||||||
|
-noaudio \
|
||||||
|
-no-boot-anim \
|
||||||
|
-camera-back none \
|
||||||
|
> artifacts/android/emulator.log 2>&1 &
|
||||||
|
echo "$!" > artifacts/android/emulator.pid
|
||||||
|
|
||||||
|
adb -s emulator-5554 wait-for-device
|
||||||
|
booted=false
|
||||||
|
for _ in $(seq 1 120); do
|
||||||
|
if [ "$(adb -s emulator-5554 shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" = "1" ]; then
|
||||||
|
booted=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
if [ "$booted" != "true" ]; then
|
||||||
|
echo "Android emulator did not finish booting" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
adb -s emulator-5554 shell settings put global window_animation_scale 0
|
||||||
|
adb -s emulator-5554 shell settings put global transition_animation_scale 0
|
||||||
|
adb -s emulator-5554 shell settings put global animator_duration_scale 0
|
||||||
|
|
||||||
|
- name: Run Android Maestro suite
|
||||||
|
run: .github/scripts/run-nightly-e2e.sh android emulator-5554
|
||||||
|
|
||||||
- name: Clean up Android services and emulator
|
- name: Clean up Android services and emulator
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
Reference in New Issue
Block a user