perf: speed up deploy-android via MobSF pre-warm and parallel integration tests

Start MobSF as a dep of build-android (_mobsf-start) so it warms up during
the APK build instead of blocking afterwards (saves up to 90 s). Add
_integrations task to run integration and integration-ui in parallel since
they use random Stalwart ports and different Flutter build targets.

Also add `docker rm ... || true` before `docker run` in both _mobsf-start and
mobsf_scan.sh to handle stopped-but-not-removed containers gracefully.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Güttler
2026-04-27 07:13:13 +02:00
co-authored by Claude Sonnet 4.6
parent a2d98ed9bc
commit 9c74dec866
4 changed files with 35 additions and 7 deletions
+22 -3
View File
@@ -133,9 +133,24 @@ tasks:
Android platform 34 or higher not found. Install it with:
${ANDROID_HOME:-$HOME/Android/Sdk}/cmdline-tools/latest/bin/sdkmanager "build-tools;34.0.0" "platforms;android-34"
_mobsf-start:
internal: true
run: once
cmds:
- cmd: |
if ! docker ps -q --filter name=mobsf-sharedinbox | grep -q .; then
docker rm mobsf-sharedinbox 2>/dev/null || true
docker pull -q opensecurity/mobile-security-framework-mobsf:latest >/dev/null 2>&1 || true
docker run -d --rm \
--name mobsf-sharedinbox \
-p 8000:8000 \
-e MOBSF_API_KEY=sharedinbox-dev \
opensecurity/mobile-security-framework-mobsf:latest >/dev/null
fi
build-android:
desc: Build a release APK and run a MobSF security scan
deps: [_preflight, _android-sdk-check, _pub-get]
deps: [_preflight, _android-sdk-check, _pub-get, _mobsf-start]
cmds:
- ANDROID_HOME=${ANDROID_HOME:-$HOME/Android/Sdk} fvm flutter build apk --release --no-pub | grep -Ev "was tree-shaken|Tree-shaking can be disabled"
- scripts/mobsf_scan.sh
@@ -177,10 +192,14 @@ tasks:
desc: Pre-commit checks — analyze + unit tests + widget tests (no build, no integration)
deps: [analyze, test, test-widget]
_integrations:
internal: true
run: once
deps: [integration, integration-ui]
check:
desc: Full check suite — unit tests first, then integration (merges coverage), then gate
deps: [analyze, test-widget, build-linux, test]
cmds:
- task: integration
- task: integration-ui
- task: _integrations
- task: coverage
+12
View File
@@ -6,6 +6,18 @@ Tasks get moved from next.md to done.md
## Tasks
## Speed up `task deploy-android`
Two parallelism improvements:
- `_integrations` internal task: runs `integration` and `integration-ui` in parallel (they use
random Stalwart ports and different Flutter build targets so there is no conflict).
- `_mobsf-start` internal task: starts the MobSF Docker container as a dep of `build-android`,
so it warms up concurrently with the APK build instead of blocking for up to 90 s afterwards.
- `scripts/mobsf_scan.sh`: added `docker rm $CONTAINER_NAME 2>/dev/null || true` before
`docker run` to handle stopped-but-not-yet-removed containers (same fix applied to the new
`_mobsf-start` task).
## Android E2E test verifies APK before deploy
`task deploy-android` now runs `integration-android` (the full Android E2E test) before
-4
View File
@@ -18,10 +18,6 @@ Then commit.
## Tasks
make `task deploy-android` faster. More concurrent tasks? Caching?
---
I opened an account. How to get back to the list of accounts?
I saw no way to do that.
+1
View File
@@ -24,6 +24,7 @@ command -v docker >/dev/null 2>&1 || { echo "docker not found — install Docker
# Start MobSF if not already running.
if ! docker ps --format '{{.Names}}' 2>/dev/null | grep -q "^${CONTAINER_NAME}$"; then
echo "Starting MobSF Docker container (this may take a moment on first run)..."
docker rm "$CONTAINER_NAME" 2>/dev/null || true
# Pull quietly first so progress-bar noise doesn't overwrite other output.
docker pull -q opensecurity/mobile-security-framework-mobsf:latest >/dev/null 2>&1
docker run -d --rm \