Skip to content

Commit 7029d9d

Browse files
Robclaude
andcommitted
fix(ci): fix emulator script execution and add lint baseline
android-emulator-runner@v2 runs the script: field line-by-line via /usr/bin/sh -c, breaking backslash continuations and multi-line if blocks. Move the emulator script to .github/scripts/race-detection.sh (#!/bin/bash) so it executes as a proper shell script. Add Common/lint-baseline.xml covering the 385 pre-existing lint errors so the lint gate only fails on new issues introduced after this commit. Wire it into Common/build.gradle via lint { baseline }. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 69fb40b commit 7029d9d

4 files changed

Lines changed: 1188 additions & 35 deletions

File tree

.github/scripts/race-detection.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
APP_APK=$(find Common/build/outputs/apk/mobileLibre3SiDexNogoogle/debug -name "*.apk" ! -name "*-unsigned*" | head -1)
5+
TEST_APK=$(find Common/build/outputs/apk/androidTest/mobileLibre3SiDexNogoogle/debug -name "*.apk" | head -1)
6+
7+
echo "App APK: $APP_APK"
8+
echo "Test APK: $TEST_APK"
9+
10+
adb shell dumpsys batterystats --reset || true
11+
12+
adb logcat -c
13+
adb install -r -t "$APP_APK"
14+
15+
if [[ -n "$TEST_APK" ]]; then
16+
adb install -r -t "$TEST_APK"
17+
adb shell am instrument -w -e size small \
18+
"cloud.glucodroid.debug.test/androidx.test.runner.AndroidJUnitRunner" \
19+
2>&1 | tee instrumentation.log || true
20+
fi
21+
22+
# Launch app and let it run for 30 seconds to surface any startup races
23+
adb shell monkey -p cloud.glucodroid.debug -c android.intent.category.LAUNCHER 1 || true
24+
sleep 30
25+
26+
adb logcat -d > logcat-full.log
27+
adb shell dumpsys batterystats > batterystats.txt || true

.github/workflows/android-static-analysis.yml

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -183,41 +183,7 @@ jobs:
183183
disable-animations: true
184184
disk-size: 6000M
185185
heap-size: 512M
186-
script: |
187-
set -eu
188-
189-
APP_APK=$(find Common/build/outputs/apk/mobileLibre3SiDexNogoogle/debug \
190-
-name "*.apk" ! -name "*-unsigned*" | head -1)
191-
TEST_APK=$(find Common/build/outputs/apk/androidTest/mobileLibre3SiDexNogoogle/debug \
192-
-name "*.apk" | head -1)
193-
194-
echo "App APK: $APP_APK"
195-
echo "Test APK: $TEST_APK"
196-
197-
# Reset battery stats before the run
198-
adb shell dumpsys batterystats --reset || true
199-
200-
adb logcat -c
201-
adb install -r -t "$APP_APK"
202-
203-
if [[ -n "$TEST_APK" ]]; then
204-
adb install -r -t "$TEST_APK"
205-
# Run smoke-size instrumented tests; capture full output
206-
adb shell am instrument -w \
207-
-e size small \
208-
"cloud.glucodroid.debug.test/androidx.test.runner.AndroidJUnitRunner" \
209-
2>&1 | tee instrumentation.log || true
210-
fi
211-
212-
# Launch app and let it run for 30 seconds to surface any startup races
213-
adb shell monkey -p cloud.glucodroid.debug \
214-
-c android.intent.category.LAUNCHER 1 || true
215-
sleep 30
216-
217-
adb logcat -d > logcat-full.log
218-
219-
# Dump batterystats for wakelock analysis
220-
adb shell dumpsys batterystats > batterystats.txt || true
186+
script: bash .github/scripts/race-detection.sh
221187

222188
- name: Analyse logcat for race / thread violations
223189
if: always()

Common/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@ buildTypes {
561561
}
562562
lint {
563563
abortOnError false
564+
baseline file("lint-baseline.xml")
564565
}
565566
dependenciesInfo {
566567
includeInApk true

0 commit comments

Comments
 (0)