Android CI with
Anton Malinskiy
Development Manager & Principal Engineer, Agoda
Why CI/CD?
Phase 1: project init
Phase 2: more people
Phase 3: more teams
Phase 4+: more people
The Problem
A
B
C
develop/master
Git log of a large team
CI/CD
A
B
C
Prerequisites
Prerequisites: software
Prerequisites: hardware
Prerequisites: knowledge
Deployment of CI/CD
CI/CD installation on kubernetes
CI/CD pipeline for infrastructure
CI/CD pipeline for infrastructure
CI worker with ServiceAccount credentials
Kubernetes API
CI server
VCS
helm/kubectl deployment
Deployment change
Deployment of CI image
Unit testing
Unit testing
Unit testing
Unit testing
Unit testing: JVM considerations
Unit testing: JVM considerations
Unit testing: JVM considerations
Unit testing: JVM considerations
Unit testing: monitoring
What can you do with monitoring?
Unit testing: G1GC, OOM crash
Unit testing: ConcMarkSweep, maxParallelForks=1
Unit testing: ConcMarkSweep, maxParallelForks=4
Unit testing: SerialGC, maxParallelForks=4
Application deployment
Instrumented tests
The problem
Agent
Agent
Agent
Agent
Device
?
Device
?
Emulator?
Emulator?
?
Android connections
console 5554
adb 5555
Android
telnet ip console
adb connect ip:adb
adbd
adbd 5037
Real devices
kubectl label nodes node-x.cluster.local openstf.io/provider=true
kubectl taint nodes node-x.cluster.local openstf.io/provider=true:NoSchedule
Emulators
Android requires custom kernel => virtualization
kubectl label nodes node-x.cluster.local openstf.io/emulator=kvm
Emulators: qemu
Android options:
qemu-system-i386 $ANDROID_OPTS -qemu $QEMU_OPTS
Emulators: config.ini
ANDROID_CONFIG=” \
skin.name=600x1024;\
hw.lcd.density=160; \
hw.lcd.height=600; \
hw.lcd.width=1024; \
hw.device.name=7in WSVGA (Tablet); \
avd.ini.displayname=7 WSVGA (Tablet) API 23;”
Emulators: GPU rendering
Emulators: image size
Main contributors:
tar.gz
Emulators: unique id trick
Default mode
TCP/IP mode
$ adb devices
List of devices attached
emulator-5554 device
$ adb devices
List of devices attached
10.2.5.177:5555 device
emulator-5554 device
Emulators: additional tips
The problem
Agent
Agent
Agent
Agent
Device
Device
Emulator
Emulator
?
Instrumented tests: OpenSTF
Instrumented tests: OpenSTF
Connecting to remote devices
Agent
Agent
Agent
Agent
Device
Device
Emulator
Emulator
?
Connecting to remote devices
adb connect 10.0.0.1:5555
stf-client connect -n 30 -f sdk:25
stf-client connect -n 4 -f notes:tablet
Connecting to remote devices
Connecting to remote devices
Agent
?
Agent
?
Agent�?
Agent�?
Device
Device
Emulator
Emulator
Test runner
Test runner
Test runner
Test runner
Test runner
Test runner
Test runner
Test runner
Everything eventually fails
Stability: usb devices, software
Stability: usb devices, hardware
Stability: emulators
Stability: remote connection
Monitoring
Metrics are collected from
Monitoring
Monitoring
Monitoring
Performance statistics: unit tests
Duration [p90] | 18 minutes |
Count | 16_000+ |
Total tests run | 180_000_000+ |
Performance statistics: instrumented tests
Kakao
Duration for 1 device | 10 hours |
Duration for 30 devices [p90] | 30 minutes |
Duration for 20 devices [p90] | 35 minutes |
Count | 1_100+ |
Total tests run | 6_000_000+ |
Licensing issue
make PROXY=registry-url/ build tag push
Links
Q&A
Cost, 60 devices, 24/7, 1 year
Firebase test lab
$5 device/hour
365x24x60=525600 hours
Total: $2_628_000
In-house solution
$700 x 60 devices
$80k support engineer
$20k servers + $5k etc
Total: $147_000
¢28 device/hour
Android CI
with