Context
An ed-tech company builds a store app for each school, about 660 of them. I owned the rewrite of that build pipeline in 2026.
The problem
Builds for each school app took most of an hour, were costly, and ran on long-lived machines that held signing keys.
What I did
I profiled the Android build and rewrote it around Gradle parameters. The app namespace is fixed and only the application id changes per school, so Gradle can reuse its cache between schools.
I gave Gradle a bigger heap and ran it in parallel, since the code shrinker was the bottleneck.
I moved the Android runner to per-build virtual machines that hold no keys and delete themselves, with back-pressure when capacity runs out. That work has its own page.
I added caching to the iOS pipeline for node_modules, CocoaPods, ccache and Metro. That work also has its own page.
I closed an unauthenticated path to production publishing.
Key decision
I chose ephemeral runners over a managed build service. They are about 4 times faster, and they hold no long-lived keys.
The cost is that I own capacity, so I added a queue and a 429 response when the fleet is full.
Result
Android builds per school went from 40 to 50 minutes down to 6 to 8 minutes. The Android runner moved from about 24 to about 6 minutes, and warm iOS builds from 157 to about 30 minutes.
One side find: a silent image-tool bug shipped default branding in 61 builds across 29 schools. The build now fails instead of warning.
What I learned
Fixing the build first and the runner second kept each gain easy to attribute. What I have not done is compare cost per build before and after; I would do that next.
Stack
- Gradle
- Node.js
- GCE
- Cloud Build
- Azure DevOps
- ccache
- Terraform
