-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(infra-2854): add cross-platform build caching #19656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c4ca996
to
cc39d5e
Compare
Caution MetaMask internal reviewing guidelines:
|
This reverts commit e7dc9d1.
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
- Fix critical bug where fingerprint file contained CLI output instead of hash - Add robust error handling and validation for repacking process - Implement APK backup/restore for failed repack attempts - Add comprehensive logging showing fingerprints and decision reasoning - Include cache hit tracking and performance metrics - Add APK size and structure validation - Create detailed documentation in docs/build-caching.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a build caching mechanism using fingerprinting to optimize CI/CD build times. The system can detect when only JavaScript/TypeScript code changes and reuse previously built APKs, saving significant build time by repacking with updated JS bundles instead of rebuilding native code.
- Introduces fingerprinting scripts to detect native code changes using Expo Fingerprint
- Adds build optimization logic to choose between full builds, repacking, or skipping builds entirely
- Implements caching strategies for build artifacts and fingerprints across GitHub Actions workflows
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
scripts/generate-fingerprint.js | New script to generate fingerprint hash for native code dependencies |
scripts/check-fingerprint.js | New script to compare current vs saved fingerprints for build decisions |
package.json | Adds fingerprint scripts and new dependencies (@expo/fingerprint, @expo/repack-app) |
docs/build-caching.md | Comprehensive documentation explaining the fingerprinting system and implementation |
README.md | Links to new build caching documentation |
.github/workflows/temp-ios-workflow.yml | Disables temporary iOS workflow by commenting out configuration |
.github/workflows/needs-e2e-build.yml | Enhanced to output build actions (full/repack/skip) for each platform |
.github/workflows/ci.yml | Passes build action parameter to Android build workflow |
.github/workflows/build-android-e2e.yml | Implements fingerprint-based build optimization with repack logic |
.github/actions/save-build-fingerprint/action.yml | New action to save fingerprints and cache build artifacts |
.github/actions/fingerprint-build-check/action.yml | New action to check fingerprints and determine build method |
.fingerprintignore | Configuration to exclude non-native files from fingerprint calculation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Description
This PR implements a build caching system to optimize CI/CD pipeline performance.
.apk
,.aab
). When only JavaScript code changes are detected, it reuses the cached artifacts and repacks them with the new JS bundle using@expo/repack-app
. This avoids a full native compilation, significantly reducing build times.pod install
step, which is a common CI bottleneck.Architecture Diagram
Build Decision Flow (Android)
Build Flow (iOS)
Key Implementation Details
Android Optimization
@expo/fingerprint
): Generates a hash of native dependencies to detect when a full rebuild is needed.@expo/repack-app
): On a cache hit, it repacks the existing.apk
with the new JavaScript bundle..apk
and.aab
files using a key based on the fingerprint.iOS Optimization
ios/Pods
directory. The cache is keyed by theios/Podfile.lock
.pod install
becomes significantly faster when dependencies are cached.4. Performance Gains
Changelog
CHANGELOG entry: Added build caching for Android and iOS to optimize CI/CD build times. Android uses fingerprinting to repack JS-only changes, and iOS uses caching for CocoaPods dependencies.
Related issues
Fixes: #19620
Manual testing steps
Pre-merge author checklist
Pre-merge reviewer checklist