Skip to content

Commit b55dfa2

Browse files
committed
ci(android): add Firebase Test Lab workflow for integration tests
Adds .github/workflows/integration-tests-firebase.yml that builds the example app and instrumented test APKs via flutter/Gradle and runs the full integration test suite on real hardware via Firebase Test Lab. Changes from initial version: - Switch debug APK build to `flutter build apk --debug` so the output path is unambiguous (always build/app/outputs/apk/debug/app-debug.apk) - Gate the job on same-repo PRs only to avoid auth failures from forks (secrets are unavailable for fork pull requests) Triggers on pull_request to develop/main (same-repo) and workflow_dispatch for manual runs. Built APKs are uploaded as artifacts on every run (if: always()), retained 14 days. Adds an Integration Tests section to README.md documenting local run instructions, CI trigger, and required secrets.
1 parent da8884c commit b55dfa2

2 files changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Integration Tests (Firebase Test Lab)
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- develop
8+
- main
9+
paths:
10+
- "webtrit_callkeep/**"
11+
- "webtrit_callkeep_android/**"
12+
- "webtrit_callkeep_platform_interface/**"
13+
- ".github/workflows/integration-tests-firebase.yml"
14+
15+
jobs:
16+
integration-tests:
17+
name: Integration Tests (Firebase Test Lab)
18+
runs-on: ubuntu-latest
19+
# Skip fork PRs: secrets are not available for forks, so auth steps would fail.
20+
# workflow_dispatch always runs (no fork context).
21+
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Set up JDK 17
28+
uses: actions/setup-java@v4
29+
with:
30+
java-version: "17"
31+
distribution: temurin
32+
33+
- name: Set up Flutter
34+
uses: subosito/flutter-action@v2
35+
with:
36+
flutter-version: "3.32.0"
37+
channel: stable
38+
39+
- name: Install Flutter dependencies
40+
run: flutter pub get
41+
working-directory: webtrit_callkeep/example
42+
43+
- name: Authenticate with Google Cloud
44+
uses: google-github-actions/auth@v2
45+
with:
46+
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
47+
48+
- name: Set up Google Cloud SDK
49+
uses: google-github-actions/setup-gcloud@v2
50+
51+
- name: Build debug APK
52+
run: flutter build apk --debug
53+
working-directory: webtrit_callkeep/example
54+
55+
- name: Build instrumented test APK
56+
run: ./gradlew :app:assembleAndroidTest
57+
working-directory: webtrit_callkeep/example/android
58+
59+
- name: Run tests on Firebase Test Lab
60+
run: |
61+
gcloud firebase test android run \
62+
--type instrumentation \
63+
--app webtrit_callkeep/example/build/app/outputs/apk/debug/app-debug.apk \
64+
--test webtrit_callkeep/example/build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
65+
--device model=Pixel6,version=33,locale=en,orientation=portrait \
66+
--timeout 10m \
67+
--project ${{ secrets.FIREBASE_PROJECT_ID }}
68+
69+
- name: Upload build artifacts and test APKs
70+
if: always()
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: firebase-test-apks-${{ github.run_number }}
74+
path: |
75+
webtrit_callkeep/example/build/app/outputs/apk/debug/app-debug.apk
76+
webtrit_callkeep/example/build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk
77+
retention-days: 14

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,39 @@ Feel free to explore it, fork it, and use it as a starting point for your own ap
482482

483483
---
484484

485+
## Integration Tests (Android)
486+
487+
Integration tests live in
488+
[`webtrit_callkeep/example/integration_test/`](webtrit_callkeep/example/integration_test/)
489+
and cover lifecycle, call scenarios, state machine, foreground service timing, background service
490+
paths, and stress/concurrency scenarios.
491+
492+
Android emulators cannot run these tests reliably — `ConnectionService`, foreground service
493+
lifecycle, and dual-process (`main` + `:callkeep_core`) teardown require real hardware behaviour.
494+
495+
### Run locally
496+
497+
```bash
498+
cd webtrit_callkeep/example
499+
./run_integration_tests.sh # auto-detect connected device
500+
./run_integration_tests.sh -d <device-id> # explicit device
501+
```
502+
503+
### Run on Firebase Test Lab (CI)
504+
505+
The workflow `.github/workflows/integration-tests-firebase.yml` runs the full suite on real
506+
hardware. It triggers on PRs to `develop`/`main` (same-repo only) and can be started manually
507+
from the Actions tab via `workflow_dispatch`.
508+
509+
Required secrets (configure in GitHub repo settings):
510+
511+
| Secret | Description |
512+
| --- | --- |
513+
| `FIREBASE_SERVICE_ACCOUNT` | JSON key for a GCP service account with Firebase Test Lab permissions |
514+
| `FIREBASE_PROJECT_ID` | GCP project ID linked to your Firebase project |
515+
516+
---
517+
485518
## 📃 More Resources
486519

487520
- [CallKit Documentation (Apple)](https://developer.apple.com/documentation/callkit)

0 commit comments

Comments
 (0)