Skip to content

Cap the Xcode compilation cache and tighten the native CI path filter - #33

Merged
janicduplessis merged 1 commit into
mainfrom
@janic/ci-cache-tuning
Sep 23, 2026
Merged

janicduplessis merged 1 commit into
mainfrom
@janic/ci-cache-tuning

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Two follow-ups to #29's native CI changes, both in .github/workflows/ci.yml.

The path filter skipped both native jobs for non-ASCII paths. By default git diff --name-only prints such a path quoted and octal-escaped ("example/ios/R\303\251glages.swift"), so the ^-anchored patterns didn't match. The diff now runs with git -c core.quotePath=false. Paths containing ", \ or control characters are still quoted, because core.quotePath doesn't apply to those. The iOS list also gains example/.bundle/: its config file affects bundle install, but example/[^/]+$ only covers top-level files.

Cap the Xcode compilation cache at 1 GB. The ios-cas-* cache only grows within one lockfile generation, because each new key saves the restored CAS plus the new entries. COMPILATION_CACHE_LIMIT_SIZE=1G makes Xcode prune it. Without it, the limit is half of the free disk space plus the current CAS size. The setting isn't in Xcode 26.6's .xcspec files, but Xcode 26.6's SWBCore reads it. swift-build parses the value as bytes or a number with a K/M/G/T suffix (CASOptions.swift), and the build's prune tasks enforce it (CompilationCachingDataPruner.swift). Pruning is generational. The on-disk CAS starts a new generation once its primary directory passes half the limit (UnifiedOnDiskCache.cpp), copies entries forward as they are used, and deletes the older generation on a later build. The directory therefore stays at about 1 GB plus one build. One cold build of the example is about 474 MiB, just under the 512 MiB rotation point (179 MB compressed in the Actions cache), so a lockfile generation rotates after its first few native source changes. Cache hits carry over (see the 100M run below).

Test plan

  • The filter script on local merge commits, with the default git diff vs core.quotePath=false:
    • example/ios/Réglages.swift: ios=false → ios=true
    • android/src/main/java/Ünï.kt: android=false → android=true
    • example/.bundle/config: ios=false → ios=true, android=false
    • docs/README.md: false false either way
  • Local run on Xcode 26.6 (17F113) with the CI xcodebuild command: 100M logs note: cache size (497295101 bytes) larger than size limit (104857600 bytes) and rotates the CAS generation, and all 380 compile tasks are still cache hits. 1G logs no note.
  • CI on this PR: ios restored main's CAS and got 385 cache hits, 0 misses and no size-limit note. Across three attempts ios took 2m02s–2m28s and xcodebuild 36–44 s. The cap isn't meant to change build time.

@janicduplessis janicduplessis added the e2e-android Run the Android end-to-end check on this PR label Sep 23, 2026
@janicduplessis janicduplessis removed the e2e-android Run the Android end-to-end check on this PR label Sep 23, 2026
@janicduplessis
janicduplessis marked this pull request as ready for review September 23, 2026 22:03
@janicduplessis
janicduplessis merged commit 87e032f into main Sep 23, 2026
5 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.

1 participant