diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml index 6ef388e..fb82cf3 100644 --- a/.github/workflows/android-ci.yml +++ b/.github/workflows/android-ci.yml @@ -72,16 +72,10 @@ jobs: with: api-level: "37.0" arch: x86_64 - target: android-desktop + target: google_apis_ps16k profile: small_phone disable-animations: true - script: | - adb shell mkdir -p /storage/emulated/0/screenshots - res=0 - ./gradlew connectedOssNoadsDebugAndroidTest -PAPPID=de.szalkowski.activitylauncher.oss --build-cache || res=$? - mkdir -p screenshots - adb pull /storage/emulated/0/screenshots/. screenshots/ || true - exit $res + script: bash scripts/run_instrumented_tests.sh - name: Upload screenshots if: always() uses: actions/upload-artifact@v4 @@ -118,10 +112,10 @@ jobs: with: api-level: "37.0" arch: x86_64 - target: android-desktop + target: google_apis_ps16k profile: small_phone disable-animations: true - script: python3 scripts/test_upgrade_shortcut.py + script: bash scripts/run_upgrade_test.sh - name: Upload upgrade test artifacts if: always() uses: actions/upload-artifact@v4 diff --git a/scripts/run_instrumented_tests.sh b/scripts/run_instrumented_tests.sh new file mode 100644 index 0000000..aaafe8e --- /dev/null +++ b/scripts/run_instrumented_tests.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "Waiting for emulated storage to be mounted..." +storage_ready=false +for i in $(seq 1 30); do + if adb shell ls /storage/emulated/0 >/dev/null 2>&1; then + echo "Storage mounted." + storage_ready=true + break + fi + echo " attempt $i: storage not ready yet, waiting 2s..." + sleep 2 +done +if [ "$storage_ready" != "true" ]; then + echo "ERROR: /storage/emulated/0 not mounted after 60s" + exit 1 +fi + +adb shell mkdir -p /storage/emulated/0/screenshots +res=0 +./gradlew connectedOssNoadsDebugAndroidTest -PAPPID=de.szalkowski.activitylauncher.oss --build-cache || res=$? +mkdir -p screenshots +adb pull /storage/emulated/0/screenshots/. screenshots/ || true +exit $res diff --git a/scripts/run_upgrade_test.sh b/scripts/run_upgrade_test.sh new file mode 100644 index 0000000..0ebef79 --- /dev/null +++ b/scripts/run_upgrade_test.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "Waiting for emulated storage to be mounted..." +storage_ready=false +for i in $(seq 1 30); do + if adb shell ls /storage/emulated/0 >/dev/null 2>&1; then + echo "Storage mounted." + storage_ready=true + break + fi + echo " attempt $i: storage not ready yet, waiting 2s..." + sleep 2 +done +if [ "$storage_ready" != "true" ]; then + echo "ERROR: /storage/emulated/0 not mounted after 60s" + exit 1 +fi + +python3 scripts/test_upgrade_shortcut.py