Description
Proposal: Cache reusable native builds in GitHub
Strategy
The success of Expensify largely depends on rapid and effective engineering output to bring ideas and improvements to market quickly. Systemic problems that slow development for all engineers, have both a real cost and an opportunity cost in wasted time.
Background
As React Native developers, we work mainly with JavaScript, which is updated daily by many contributors. However, React Native requires compiling the native parts of our app every time we build, even when there are no native changes. Existing local and remote caching systems are in place, but they often fail or require manual debugging. For EApp/Hybrid, a complete build can take 20-30 minutes per platform, and new developers sometimes spend hours wrestling with environment-specific build errors.
Problem
When engineers push new changes to the remote or build the app locally, long build times slow down the development process, which prevents us from maintaining efficient feedback cycles.
Solution
We propose a two-part solution:
- Introduce a small collection of GitHub actions and workflows to build debug and release versions of EApp/Hybrid iOS and Android apps, only when native changes are involved, completely skipping the native build for JS-only changes.
- Accompany it with a CLI plugin for downloading builds produced and hosted in GitHub CI, instead of building everything once again locally.
Before/After
- Remote build: ~25mins 100% of the time -> ~7s 90% of the time
- Local clean build: ~25mins 100% of the time -> ~1.5mins 90% of the time
- Local cached build: 12-30s 100% of the time -> 12s 100% of the time
For the remaining ~10% containing native changes, only a single remote build will trigger, producing an artifact for everyone to reuse. With the above changes, we can turn 25min long AdHoc builds into a <10s signing step and 25min local builds into 1-2min download steps.