Our mobile CI build took 38 minutes. Now it takes 14.
Our mobile CI build took 38 minutes. Now it takes 14. Nothing we did was exotic. Most of it is the kind of work teams skip because the build "works", and a working build never makes it to the top of the backlog.
Why a slow build is more expensive than it looks
The obvious cost is waiting. At 20 builds a week, a 24-minute saving removes 8 hours of waiting from the team, every week.
The larger cost is behavioural. When a build takes most of an hour, developers stop pushing small changes. They batch work into bigger pull requests, reviews get harder, and releases become rarer and riskier. Slow CI does not just cost minutes. It teaches a team to avoid exactly the small, safe releases that keep a mobile product healthy.
What actually moved the needle
Four changes did the work. Each one removes a different kind of waste.
| Change | The waste it removes |
|---|---|
| Cache CocoaPods and the Gradle build cache between runs | Downloading and compiling the same dependencies on every run |
| Skip native rebuilds when only JavaScript changed | A full native compile for a change that never touched native code |
| Run lint, tests and builds in parallel | Jobs queued behind each other for no technical reason |
| Move iOS builds to Apple Silicon runners | Compile time on slower Intel hardware |
Caching what does not change
A mobile build spends a surprising share of its time re-creating things that were identical yesterday: installed pods, resolved Gradle dependencies, compiled modules that nobody edited. Persisting the CocoaPods directory and the Gradle build cache between runs turns that work into a restore step. The important detail is the cache key. Keyed on the lockfiles, the cache stays valid until a dependency really changes, and is rebuilt exactly when it should be.
A fingerprint of the native layer
Most changes to a React Native app are JavaScript only, and a JavaScript change does not need a new native binary. We compute a fingerprint of everything that affects the native build: native dependencies, native source, build configuration. If the fingerprint matches the last build, the native compile is skipped and the existing binary is reused.
The same check decides how a change ships. JavaScript-only changes go out through over-the-air updates, so most fixes never wait for a full build or a store review.
Parallel instead of a chain
Our old pipeline ran lint, then tests, then the builds, one after another. None of those steps depends on the others. Running them side by side means the pipeline takes as long as its slowest job, not the sum of all of them, and a lint error is reported in a couple of minutes instead of after a full build.
Apple Silicon runners for iOS
Xcode builds are heavily CPU bound, and Apple Silicon machines compile noticeably faster than the Intel runners many pipelines still default to. This was the simplest change of the four: a different runner type, and the same job finishes sooner.
Where to start
- Measure each step first. The slowest step is rarely the one the team complains about.
- Cache before you optimise. It is the cheapest win and it compounds with everything else.
- Separate "JavaScript changed" from "native changed". In a React Native project that single distinction removes most full builds.
- Treat build time as a product metric. It decides how often your team is willing to ship.
A build that works is not the same as a build that is fast enough. Slow CI quietly changes how a team ships.
