Skip to content

ci(ios): make ccache actually cache the iOS build - #754

Merged
gre merged 4 commits into
masterfrom
ci/ios-ccache
Oct 29, 2026
Merged

gre merged 4 commits into
masterfrom
ci/ios-ccache

Conversation

@gre

@gre gre commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

The iOS build takes ~40–70 min on the free macOS runners, and ccache (tried in #752) recorded nothing even though every compile went through RN's wrapper.

Why: RN's scripts/xcode/ccache-clang.sh runs $CCACHE_BINARY clang. pod install (with USE_CCACHE=1) sets CCACHE_BINARY as a build setting, but Xcode doesn't pass build settings to compiler processes, so the wrapper ran plain clang. Checked locally with a probe compiler: the build setting arrives empty, while a variable exported in the shell reaches the wrapper.

Changes (ios job):

  • brew install ccache and export CCACHE_BINARY via GITHUB_ENV; USE_CCACHE=1 on pod install.
  • ccache in $RUNNER_TEMP/ccache: restored everywhere, saved from master only (keyed on the example lockfile + Podfile, trimmed to 2 GB), like Gradle/NuGet.
  • NSUnbufferedIO=YES: xcodebuild output was block-buffered, so log timestamps showed a misleading 25–45 min "pause" in the Skia compile.
  • -showBuildTimingSummary to see where the build time actually goes, and COMPILER_INDEX_STORE_ENABLE=NO.

Results (measured on this PR, a branch-only cache save was added then reverted):

cold (empty cache) warm (cache restored)
ccache 505/508 cacheable, 0 hits 505/505 hits (100%, direct)
Build iOS step 65 min 2 min 43 s
iOS job total – 20 min (Detox 5/5, all snapshots 0.000%, XCTest, podspec lint)

The build timing summary shows C/C++/ObjC compilation is ~99% of the build (505 CompileC tasks, 11 162 s cumulated vs ~190 s for everything else), which is exactly what ccache covers. The cache is 0.7 GiB on disk, 127 MB compressed.

After merging, the first master run fills the cache (cold build); PRs then restore it read-only. The cache key changes with example/package-lock.json / Podfile, and restore-keys falls back to the previous entry, so dependency bumps stay mostly warm.

The two DO NOT MERGE commits (branch cache save + empty re-run) are undone by the last commit: squash-merge to keep them out of history.

🤖 Generated with Claude Code

gre and others added 4 commits October 29, 2026 08:29
RN's ccache-clang.sh runs `$CCACHE_BINARY clang`. Pod install sets
CCACHE_BINARY as a build setting, but Xcode doesn't pass build settings to
compiler processes, so the wrapper ran plain clang and ccache never saw a
call. Exporting CCACHE_BINARY in the job environment fixes it (checked
locally: the wrapper got an empty value before, the path after).

Also: line-buffered xcodebuild output (log timestamps were block-flushed,
showing a misleading 25-45 min pause), a build timing summary, and no
index store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts the temporary branch exception used to measure the warm build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gre
gre marked this pull request as ready for review October 29, 2026 09:43
Copilot AI balanced review requested due to automatic review settings October 29, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@gre
gre merged commit d2ca7cc into master Oct 29, 2026
14 checks passed
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.

2 participants