Skip to content

Commit 7163945

Browse files
committed
fix: Add timeout and cleanup for hanging emulator processes
- Add 30-minute timeout to instrumented tests to prevent indefinite hanging - Add forced cleanup of emulator/qemu processes after test completion - Add coverage file existence check before Codecov upload - Make coverage upload conditional on file existence - Use 'if: always()' for cleanup to ensure it runs even on timeout/failure Fixes issue where API level 29 emulator hangs during termination process, causing CI jobs to run indefinitely. The tests complete successfully but emulator shutdown gets stuck with 'stop: Not implemented' errors.
1 parent 4a8cf5c commit 7163945

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ jobs:
146146
adb shell input keyevent 82
147147
148148
- name: Run instrumented tests
149+
timeout-minutes: 30
149150
uses: reactivecircus/android-emulator-runner@v2
150151
with:
151152
api-level: ${{ matrix.api-level }}
@@ -156,7 +157,25 @@ jobs:
156157
disable-animations: true
157158
script: ./gradlew connectedAndroidTest
158159

160+
- name: Force cleanup emulator processes
161+
if: always()
162+
run: |
163+
pkill -f emulator || true
164+
pkill -f qemu || true
165+
166+
- name: Check coverage report exists
167+
id: coverage-check
168+
run: |
169+
if [ -f "./app/build/reports/coverage/androidTest/debug/connected/report.xml" ]; then
170+
echo "coverage_exists=true" >> $GITHUB_OUTPUT
171+
echo "Coverage report found"
172+
else
173+
echo "coverage_exists=false" >> $GITHUB_OUTPUT
174+
echo "Coverage report not found"
175+
fi
176+
159177
- name: Upload coverage to Codecov
178+
if: steps.coverage-check.outputs.coverage_exists == 'true'
160179
uses: codecov/codecov-action@v4
161180
with:
162181
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)