Skip to content

Commit

Permalink
improve check emulator script #639
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
thoutbeckers committed May 10, 2023
1 parent 9e297f2 commit b9006d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
heap-size: 1500M
profile: 3.4in WQVGA
channel: canary
script: ./check_emulator.sh
script: ./script/check_emulator.sh

- name: install ffmpeg
if: inputs.video
Expand Down Expand Up @@ -97,24 +97,9 @@ jobs:
profile: 3.4in WQVGA
channel: canary
script: |
./check_emulator.sh
./gradlew --no-configuration-cache :${{ matrix.project }}:recordVideo :${{ matrix.project }}:connectedDebugAndroidTest
./script/check_emulator.sh
./gradlew --no-configuration-cache recordVideo :${{ matrix.project }}:connectedDebugAndroidTest
- name: stop screen capture
if: always() && inputs.video
continue-on-error: true
shell: bash
run: |
ps aux | grep -m 1 ffmpeg
ps aux | grep -m 1 screenrecord
PID=$(ps aux | grep -m 1 ffmpeg | awk '{print $2}')
python -c "import os, signal; os.kill($PID, signal.SIGINT)"
sleep 2
PID=$(ps aux | grep -m 1 screenrecord | awk '{print $2}')
python -c "import os, signal; os.kill($PID, signal.SIGINT)"
sleep 5
- name: rename video
if: always() && inputs.video
run: mv video.mp4 recording-${{ matrix.project }}-${{ matrix.api-level }}.mp4
Expand Down
12 changes: 5 additions & 7 deletions check_emulator.sh → script/check_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
EMU_BOOTED=0
n=0
first_launcher=1
echo 1 > /tmp/failed
while [[ $EMU_BOOTED = 0 ]];do
echo "Test for current focus"
# $ANDROID_HOME/platform-tools/adb shell dumpsys window
Expand All @@ -11,13 +10,12 @@ echo "Current focus: ${CURRENT_FOCUS}"
case $CURRENT_FOCUS in
*"auncher"*)
if [[ $first_launcher == 1 ]]; then
echo "Launcher seems to be ready, wait 10 sec for another popup..."
sleep 10
echo "Launcher seems to be ready, wait 5 sec for another popup..."
sleep 5
first_launcher=0
else
echo "Launcher is ready, Android boot completed"
EMU_BOOTED=1
rm /tmp/failed
fi
;;
*"Not Responding: com.android.systemui"*)
Expand All @@ -44,9 +42,9 @@ first_launcher=1
;;
*)
n=$((n + 1))
echo "Waiting Android to boot 10 sec ($n)..."
sleep 10
if [ $n -gt 60 ]; then
echo "Waiting Android to boot 5 sec ($n)..."
sleep 5
if [ $n -gt 120 ]; then
echo "Android Emulator does not start in 10 minutes"
exit 2
fi
Expand Down

0 comments on commit b9006d4

Please sign in to comment.