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:
30
.github/workflows/android-ui-tests.yml
vendored
Normal file
30
.github/workflows/android-ui-tests.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Android UI Tests
|
||||
on:
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
push:
|
||||
branches: [main, master]
|
||||
jobs:
|
||||
ui-tests:
|
||||
runs-on: macos-14
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with: { distribution: temurin, java-version: 17 }
|
||||
- name: Accept Android licenses
|
||||
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true
|
||||
- name: Verify test-tag parity
|
||||
run: ./scripts/verify_test_tag_parity.sh
|
||||
- name: Run unit tests
|
||||
run: ./gradlew :composeApp:testDebugUnitTest
|
||||
- name: Run instrumented tests (managed device)
|
||||
run: ./gradlew :composeApp:pixel7Api34DebugAndroidTest
|
||||
env:
|
||||
GRADLE_OPTS: -Xmx4g -XX:+UseParallelGC
|
||||
- name: Upload test reports
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-reports
|
||||
path: composeApp/build/reports/
|
||||
@@ -181,6 +181,15 @@ android {
|
||||
testOptions {
|
||||
unitTests.isIncludeAndroidResources = true
|
||||
unitTests.isReturnDefaultValues = true
|
||||
managedDevices {
|
||||
localDevices {
|
||||
create("pixel7Api34") {
|
||||
device = "Pixel 7"
|
||||
apiLevel = 34
|
||||
systemImageSource = "aosp-atd"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Fast PR gating subset
|
||||
com.tt.honeyDue.AAA_SeedTests
|
||||
com.tt.honeyDue.Suite1_RegistrationTests
|
||||
com.tt.honeyDue.Suite5_TaskTests
|
||||
com.tt.honeyDue.SuiteZZ_CleanupTests
|
||||
@@ -0,0 +1,10 @@
|
||||
# Full instrumented suite — all top-level suite classes (seed + per-feature suites + parallel Suite9/Suite10 + cleanup)
|
||||
com.tt.honeyDue.AAA_SeedTests
|
||||
com.tt.honeyDue.Suite1_RegistrationTests
|
||||
com.tt.honeyDue.Suite4_ComprehensiveResidenceTests
|
||||
com.tt.honeyDue.Suite5_TaskTests
|
||||
com.tt.honeyDue.Suite7_ContractorTests
|
||||
com.tt.honeyDue.Suite8_DocumentWarrantyTests
|
||||
com.tt.honeyDue.Suite9_E2ERegressionTests
|
||||
com.tt.honeyDue.Suite10_AccessibilityTests
|
||||
com.tt.honeyDue.SuiteZZ_CleanupTests
|
||||
@@ -0,0 +1,7 @@
|
||||
# Parallel-safe subset — excludes Suite9 E2E regression (sequential) and ordering-sensitive cleanup
|
||||
com.tt.honeyDue.Suite1_RegistrationTests
|
||||
com.tt.honeyDue.Suite4_ComprehensiveResidenceTests
|
||||
com.tt.honeyDue.Suite5_TaskTests
|
||||
com.tt.honeyDue.Suite7_ContractorTests
|
||||
com.tt.honeyDue.Suite8_DocumentWarrantyTests
|
||||
com.tt.honeyDue.Suite10_AccessibilityTests
|
||||
30
scripts/run_ui_tests.sh
Executable file
30
scripts/run_ui_tests.sh
Executable 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"
|
||||
Reference in New Issue
Block a user