Skip to content

Cache React Native iOS builds with sccache - #638

Draft
kieran-osgood-shopify wants to merge 1 commit into
kieran-osgood/macos-ci-8-derived-data-cachefrom
kieran-osgood/macos-ci-9-ccache
Draft

Cache React Native iOS builds with sccache#638
kieran-osgood-shopify wants to merge 1 commit into
kieran-osgood/macos-ci-8-derived-data-cachefrom
kieran-osgood/macos-ci-9-ccache

Conversation

@kieran-osgood-shopify

@kieran-osgood-shopify kieran-osgood-shopify commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Stack context

Part of the macOS CI migration and speed-up tracked in shop/issues-checkout-kit#1211, under shop/issues-checkout-kit#1202.

What?

  • Adds an opt-in React Native iOS sccache launcher used by both sample build scripts.
  • Enables it in both Bitrise React Native iOS workflows and persists the compiler cache across commits.
  • Centralizes exact and fallback key generation in reusable restore/save step bundles.
  • Uses Xcode's native C_COMPILER_LAUNCHER integration instead of treating sccache clang as an executable path.
  • Starts the sccache daemon before invoking Xcode.
  • Disables Clang header modules and response files for cached builds, as required by the upstream Xcode integration.
  • Explicitly links the sample's existing CoreMotion dependency because disabling modules removes Reanimated's implicit framework auto-link metadata.

Why?

Shopify no longer permits ccache. sccache supports Xcode launchers, but deliberately bypasses Clang header-module invocations such as React Native's -fmodules calls. Following the complete upstream Xcode recipe makes every C, C++, and assembler invocation in these builds cacheable without wrappers or a banned dependency.

The integration remains opt-in locally with SCCACHE_ENABLED=1; Bitrise enables it for the two React Native iOS workflows. Android's existing sccache integration is unchanged.

Local performance

Each warm measurement deleted DerivedData while retaining only SCCACHE_DIR, forcing Xcode to reconstruct the build products from compiler-cache entries.

Workflow Cold cache Warm cache Reduction Warm hit rate
React Native sample build 259.12s 53.53s 79.3% 1,194 / 1,194 (100%)
React Native integration tests 201.52s 57.86s 71.3% 729 / 729 (100%)

Both cold runs had zero non-cacheable compiler calls, cache errors, or compilation failures.

Bitrise performance

The two affected workflows were first run cold and warm on separate Bitrise macOS machines. The warm runs restored an exact cache-key match. After moving key generation into shared step bundles, commit 48964fb3 was also run against the previous commit's cache: both workflows missed the new exact key, restored the branch-prefix fallback, and saved the cache under the newly generated exact key.

Workflow Cold build step Exact-key warm Bundled branch-fallback run Warm compiler result
React Native sample 3.6m 51.91s 44.79s 100% hits, 0 compilations
React Native integration tests 2.8m 56.95s 51.75s 729 / 729 hits, 0 compilations

All warm workflows passed with zero misses, non-cacheable calls, or cache errors.

Verification

  • React Native iOS sample cold and warm builds: Build Succeeded
  • React Native iOS integration cold and warm runs: 68 tests, 0 failures; Test Succeeded
  • Repository dev style: passed
  • Sample and integration CocoaPods installs with --deployment: passed
  • Ruby script suite: 295 runs, 754 assertions, 0 failures
  • bitrise validate --config=e2e/bitrise.yml: valid
  • YAML parsing, shell syntax, and git diff --check: passed

@kiftio

kiftio commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

yo, just browsing.. Should we use sccache to match up with what we run locally?

@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-8-derived-data-cache branch from 4f7cff0 to 53ccdf5 Compare August 14, 2026 12:37
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from af6792e to f119714 Compare August 14, 2026 12:37
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-8-derived-data-cache branch from 53ccdf5 to 265cbfd Compare August 14, 2026 16:32
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch 2 times, most recently from 052fcaf to e1a61a7 Compare August 17, 2026 11:00
@kieran-osgood-shopify kieran-osgood-shopify changed the title Enable ccache for the React Native pods on CI Remove invalid sccache configuration from React Native iOS builds Aug 17, 2026
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from e1a61a7 to 3287d81 Compare August 17, 2026 12:03
@kieran-osgood-shopify kieran-osgood-shopify changed the title Remove invalid sccache configuration from React Native iOS builds Cache React Native iOS builds with sccache Aug 17, 2026
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from 3287d81 to 48964fb Compare August 17, 2026 12:30
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-8-derived-data-cache branch from 265cbfd to ee6e3b8 Compare August 17, 2026 15:50
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from 48964fb to 9e74331 Compare August 17, 2026 15:50
@kieran-osgood-shopify
kieran-osgood-shopify changed the base branch from kieran-osgood/macos-ci-8-derived-data-cache to graphite-base/638 August 18, 2026 16:23
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from 9e74331 to c34a998 Compare August 18, 2026 17:03
@graphite-app
graphite-app Bot changed the base branch from graphite-base/638 to kieran-osgood/macos-ci-8-derived-data-cache August 18, 2026 17:03
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from c34a998 to bf946d5 Compare August 18, 2026 17:03
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from bf946d5 to 0604d45 Compare August 18, 2026 18:26
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-8-derived-data-cache branch from ae6a0b4 to e0b1a54 Compare August 18, 2026 18:26
Assisted-By: devx/669fe7a5-1428-4dee-a8b4-995403d59a5c
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-9-ccache branch from 0604d45 to c658ce0 Compare August 19, 2026 14:09
@kieran-osgood-shopify
kieran-osgood-shopify force-pushed the kieran-osgood/macos-ci-8-derived-data-cache branch from e0b1a54 to ccf2e33 Compare August 19, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants