@@ -235,6 +235,7 @@ jobs:
235235 PYBLE_ANDROID_LOG_DIR : /tmp/pyble-android-integration
236236 PYBLE_ANDROID_RAW_EMULATOR_LOG : /tmp/pyble-android-emulator.log
237237 ANDROID_AVD_HOME : /tmp/pyble-android-avd
238+ GRADLE_USER_HOME : /tmp/pyble-gradle-home
238239 steps :
239240 - uses : actions/checkout@v4
240241 - name : Set up Flutter 3.44.1 (pinned, stable) + SDK cache
@@ -247,6 +248,19 @@ jobs:
247248 run : flutter pub get --enforce-lockfile
248249 - name : Generate localizations from ARB (X-12/FR-I18N-1)
249250 run : flutter gen-l10n
251+ - name : Bound Android Gradle resources
252+ shell : bash
253+ run : |
254+ set -euo pipefail
255+ mkdir -p "$GRADLE_USER_HOME"
256+ printf '%s\n' \
257+ 'org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=1024m -XX:ReservedCodeCacheSize=256m' \
258+ 'org.gradle.daemon=false' \
259+ 'org.gradle.workers.max=1' \
260+ 'org.gradle.parallel=false' \
261+ 'systemProp.file.encoding=UTF-8' \
262+ 'kotlin.compiler.execution.strategy=in-process' \
263+ > "$GRADLE_USER_HOME/gradle.properties"
250264 - name : Install pinned Android SDK packages
251265 shell : bash
252266 run : |
@@ -355,16 +369,38 @@ jobs:
355369 # avdmanager pre-populates these keys. Upsert them so the emulator
356370 # cannot select an earlier device-profile value from a duplicate.
357371 python3 ../tools/ci/android_avd_config.py "$AVD_CONFIG" \
358- --set 'hw.ramSize=3072 ' \
359- --set 'hw.cpu.ncore=2 ' \
360- --set 'vm.heapSize=512 ' \
372+ --set 'hw.ramSize=2048 ' \
373+ --set 'hw.cpu.ncore=1 ' \
374+ --set 'vm.heapSize=384 ' \
361375 --set 'disk.dataPartition.size=6144M' \
362376 --set 'hw.lcd.width=2560' \
363377 --set 'hw.lcd.height=1600' \
364378 --set 'hw.lcd.density=320' \
365379 --set 'hw.initialOrientation=landscape' \
366380 --set 'hw.gpu.enabled=yes' \
367381 --set 'hw.gpu.mode=swiftshader_indirect'
382+ - name : Prebuild Android integration application
383+ shell : bash
384+ run : |
385+ set -euo pipefail
386+ PREBUILD_STATUS=0
387+ timeout --signal=TERM --kill-after=30s 18m \
388+ flutter build apk \
389+ --debug \
390+ --no-pub \
391+ --target-platform android-x64 \
392+ --target integration_test/android_smoke_test.dart \
393+ >"$PYBLE_ANDROID_LOG_DIR/flutter-build.log" 2>&1 \
394+ || PREBUILD_STATUS=$?
395+ cat "$PYBLE_ANDROID_LOG_DIR/flutter-build.log"
396+ timeout --signal=TERM --kill-after=5s 30s \
397+ ./android/gradlew --stop \
398+ >"$PYBLE_ANDROID_LOG_DIR/gradle-stop.log" 2>&1 || true
399+ cat "$PYBLE_ANDROID_LOG_DIR/gradle-stop.log"
400+ if [ "$PREBUILD_STATUS" -ne 0 ]; then
401+ exit "$PREBUILD_STATUS"
402+ fi
403+ test -s build/app/outputs/flutter-apk/app-debug.apk
368404 - name : Boot headless emulator (KVM + software GPU)
369405 shell : bash
370406 run : |
@@ -389,8 +425,8 @@ jobs:
389425 -camera-front none \
390426 -accel on \
391427 -gpu swiftshader_indirect \
392- -memory 3072 \
393- -cores 2 \
428+ -memory 2048 \
429+ -cores 1 \
394430 >"$PYBLE_ANDROID_RAW_EMULATOR_LOG" 2>&1 &
395431 EMULATOR_PID=$!
396432 printf '%s\n' "$EMULATOR_PID" \
@@ -441,13 +477,19 @@ jobs:
441477 shell : bash
442478 run : |
443479 set -euo pipefail
444- timeout --signal=TERM --kill-after=30s 30m \
445- flutter test \
480+ TEST_STATUS=0
481+ timeout --signal=TERM --kill-after=30s 12m \
482+ flutter drive \
446483 --no-pub \
447- integration_test/android_smoke_test.dart \
484+ --driver test_driver/integration_test.dart \
485+ --target integration_test/android_smoke_test.dart \
486+ --use-application-binary build/app/outputs/flutter-apk/app-debug.apk \
487+ --timeout 660 \
448488 -d "$PYBLE_ANDROID_SERIAL" \
449- --reporter expanded \
450- 2>&1 | tee "$PYBLE_ANDROID_LOG_DIR/flutter-test.log"
489+ >"$PYBLE_ANDROID_LOG_DIR/flutter-drive.log" 2>&1 \
490+ || TEST_STATUS=$?
491+ cat "$PYBLE_ANDROID_LOG_DIR/flutter-drive.log"
492+ exit "$TEST_STATUS"
451493 - name : Collect bounded Android diagnostics
452494 if : always()
453495 shell : bash
0 commit comments