Skip to content

Commit 546f7d4

Browse files
committed
ci: emulator boot handling
1 parent 5be569a commit 546f7d4

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

.github/workflows/ui-tests.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches: [ "master" ]
66
pull_request:
77
branches: [ "master" ]
8-
98
workflow_dispatch:
109

1110
jobs:
@@ -53,15 +52,16 @@ jobs:
5352
# Pull the Android emulator image
5453
docker pull budtmo/docker-android:emulator_13.0_v2.16.2-p0
5554
56-
# Run the container
55+
# Run the container with environment variables for faster boot
5756
docker run -d --name android-container \
5857
-p 4723:4723 -p 6080:6080 -p 5554:5554 -p 5555:5555 \
58+
-e EMULATOR_ARGS="-no-snapshot-save -no-audio -no-boot-anim -no-window -gpu swiftshader_indirect -accel on" \
5959
--privileged \
6060
budtmo/docker-android:emulator_13.0_v2.16.2-p0
6161
6262
# Wait for container to fully initialize
6363
echo "Waiting for Android container to initialize..."
64-
sleep 90
64+
sleep 120 # Increased from 90 to 120 seconds
6565
6666
# Check container status
6767
docker ps
@@ -84,29 +84,33 @@ jobs:
8484
# Connect to the emulator
8585
adb connect $CONTAINER_IP:5555
8686
87-
# Wait for device to be fully booted
87+
# Wait for device to be fully booted (increased time)
8888
echo "Waiting for device to fully boot..."
89+
adb wait-for-device
8990
sleep 30
9091
92+
# Check boot completion
93+
while true; do
94+
boot_completed=$(adb shell getprop sys.boot_completed | tr -d '\r')
95+
if [ "$boot_completed" == "1" ]; then
96+
break
97+
fi
98+
echo "Waiting for boot to complete..."
99+
sleep 10
100+
done
101+
91102
# Check connected devices
92103
adb devices -l
93104
94105
# Disable animations
95-
adb shell settings put global window_animation_scale 0.0 || echo "Could not disable window animations"
96-
adb shell settings put global transition_animation_scale 0.0 || echo "Could not disable transition animations"
97-
adb shell settings put global animator_duration_scale 0.0 || echo "Could not disable animator duration"
106+
adb shell settings put global window_animation_scale 0.0
107+
adb shell settings put global transition_animation_scale 0.0
108+
adb shell settings put global animator_duration_scale 0.0
98109
99110
- name: Run UI Tests
100111
run: |
101-
# Check if device is connected
102-
DEVICE_COUNT=$(adb devices | grep -c device)
103-
if [ $DEVICE_COUNT -le 1 ]; then
104-
echo "No devices connected. Trying to reconnect..."
105-
CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' android-container)
106-
adb connect $CONTAINER_IP:5555
107-
sleep 10
108-
adb devices -l
109-
fi
112+
# Verify device is online
113+
adb devices
110114
111115
# Install app
112116
./gradlew installDebug
@@ -127,5 +131,6 @@ jobs:
127131
with:
128132
name: compose_test_report
129133
path: |
130-
app/build/reports/androidTests/connected/
131-
app/build/outputs/androidTest-results/connected/
134+
app/build/reports/androidTests/connected/**/*
135+
app/build/outputs/androidTest-results/connected/**/*
136+
if-no-files-found: warn

0 commit comments

Comments
 (0)