CI: Gradle Managed Devices + GitHub Actions workflow

pixel7Api34 managed device runs instrumented tests headlessly on CI.
Three test-filter profiles (ci/parallel/full) mirror iOS xctestplan
variants. run_ui_tests.sh convenience wrapper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-04-18 14:57:42 -05:00
parent 227c0a9240
commit 95a5338abd
6 changed files with 91 additions and 0 deletions

30
scripts/run_ui_tests.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Convenience script for running Android UI tests locally via the Gradle
# Managed Device (pixel7Api34). Mirrors the iOS scripts/run_ui_tests.sh
# pattern but drives the Android instrumentation runner with one of the
# three test-filter profiles under:
# composeApp/src/androidInstrumentedTest/testplans/
#
# Usage: ./scripts/run_ui_tests.sh [ci|parallel|full]
# ci - fast PR gating subset (seed + registration + tasks + cleanup)
# parallel - all non-E2E suites (safe to run in parallel shards)
# full - every suite (default)
set -euo pipefail
profile="${1:-full}"
filter_file="composeApp/src/androidInstrumentedTest/testplans/${profile}.testfilter"
if [[ ! -f "$filter_file" ]]; then
echo "Error: no test filter found at $filter_file" >&2
echo "Valid profiles: ci | parallel | full" >&2
exit 1
fi
# Flatten the file: strip comments/blank lines, comma-join the class names.
filter_arg="$(grep -v '^#' "$filter_file" | grep -v '^[[:space:]]*$' | tr '\n' ',' | sed 's/,$//')"
echo "Running Android UI tests (profile: $profile)"
echo "Filter: $filter_arg"
./gradlew :composeApp:pixel7Api34DebugAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.class="$filter_arg"