Skip to content

Conversation

@cmd-ob
Copy link
Contributor

@cmd-ob cmd-ob commented Jan 8, 2026

Problem

The setup-e2e-env action was intermittently taking 60+ minutes to complete in CI, particularly on iOS builds. Analysis of timestamped logs revealed multiple bottlenecks:

  1. CocoaPods specs download: pod install --repo-update downloading ~500 MB specs repository on every run (primary issue)
  2. Yarn cache extraction: Intermittently slow (19.5 minutes in some cases vs. seconds normally) due to GitHub Actions cache service performance variability
  3. Yarn install fetch: Extended fetch times even with cache hit, suggesting yarn wasn't leveraging global cache

The cumulative effect of these issues resulted in setup times exceeding 60 minutes.

Solution

  1. Added CocoaPods specs caching - Caches ~/.cocoapods/repos with cache key based on Podfile.lock hash for automatic invalidation when dependencies change
  2. Enabled Yarn global cache - Added YARN_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 slow

Results

  • Before: 60+ minutes (worst case when runner cache cold)
  • After with cache miss: ~3 minutes
  • After with cache hit: ~1.7 minutes total setup time
  • Improvement: 97% reduction in worst-case scenario

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 cache path: ~/.cocoapods/repos
  • CocoaPods cache key: ${{ runner.os }}-cocoapods-specs-${{ hashFiles('ios/Podfile.lock') }}
  • Caches are shared across branches when Podfile.lock is unchanged
  • Follows existing caching patterns for Yarn and Bundler in the repo
  • Uses continue-on-error: true to prevent cache failures from blocking builds
  • YARN_ENABLE_GLOBAL_CACHE enables Yarn's built-in global cache for faster dependency resolution and resilience against slow cache extraction

Notes

The existing node_modules cache (582 MB compressed) occasionally experiences slow extraction times (~20 minutes vs. normal seconds) due to GitHub Actions cache service performance variability. The YARN_ENABLE_GLOBAL_CACHE setting 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.

@cmd-ob cmd-ob changed the title Ci/speed up e2e setup ci: improve setup -e2e-env for iOS Jan 8, 2026
@cmd-ob cmd-ob merged commit c684b38 into main Jan 8, 2026
21 checks passed
@cmd-ob cmd-ob deleted the ci/speed-up-e2e-setup branch January 8, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants