ci: improve setup -e2e-env for iOS #197
Merged
+18
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
setup-e2e-envaction was intermittently taking 60+ minutes to complete in CI, particularly on iOS builds. Analysis of timestamped logs revealed multiple bottlenecks:pod install --repo-updatedownloading ~500 MB specs repository on every run (primary issue)The cumulative effect of these issues resulted in setup times exceeding 60 minutes.
Solution
~/.cocoapods/reposwith cache key based onPodfile.lockhash for automatic invalidation when dependencies changeYARN_ENABLE_GLOBAL_CACHE: 'true'environment variable to leverage Yarn 3.x's global cache mechanism, reducing redundant package fetching and mitigating impact when node_modules cache extraction is slowResults
Example run showing 1h23m setup - https://github.com/MetaMask/metamask-mobile/actions/runs/20769698711/job/59643604833
Example run showing the improvements in action: https://github.com/MetaMask/metamask-mobile/actions/runs/20809131871?pr=24288
Technical Details
~/.cocoapods/repos${{ runner.os }}-cocoapods-specs-${{ hashFiles('ios/Podfile.lock') }}Podfile.lockis unchangedcontinue-on-error: trueto prevent cache failures from blocking buildsYARN_ENABLE_GLOBAL_CACHEenables Yarn's built-in global cache for faster dependency resolution and resilience against slow cache extractionNotes
The existing
node_modulescache (582 MB compressed) occasionally experiences slow extraction times (~20 minutes vs. normal seconds) due to GitHub Actions cache service performance variability. TheYARN_ENABLE_GLOBAL_CACHEsetting provides a fallback mechanism, allowing yarn to fetch packages efficiently from its global cache even when node_modules cache extraction is slow, preventing these intermittent issues from blocking CI.Note
Cursor Bugbot is generating a summary for commit 7d4a733. Configure here.