Skip unaffected native CI jobs and cache iOS and Gradle builds - #29
Merged
Merged
Conversation
janicduplessis
force-pushed
the
@janic/native-ci-cache
branch
from
September 23, 2026 18:23
61015f7 to
5e67e7e
Compare
janicduplessis
changed the base branch from
@janic/example-drop-rn-patch
to
main
September 23, 2026 18:23
janicduplessis
marked this pull request as ready for review
September 23, 2026 18:26
This was referenced Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #28 (base
@janic/example-drop-rn-patch). Retarget tomainonce #28 merges.Description
With #28 in place, the
iosjob takes about 5 min andandroidabout 4 min, and every PR runs both, even a docs-only one. This PR skips native jobs a PR doesn't affect and caches the slow parts of each build. When the caches hit,iosdrops to about 2 min andandroidto about 2.5 min.Path filter. A new
changesjob compares the PR merge commit with its first parent (git diff HEAD^1 HEAD) and outputsios/android.iosandandroidrun only when their output istrue:src/,example/src/, top-levelexample/*files (package.json,Gemfile*,app.json, …), rootpackage.json,pnpm-lock.yaml,pnpm-workspace.yaml,.nvmrc,ci.yml,.github/actions/ios/,example/ios/,*.podspecandroid/,example/android/Any other event sets both outputs to
true: pushes tomain,merge_group,workflow_dispatch, and the Release workflow'sworkflow_call(its event is the tagpush). The job needs onlycontents: read.dorny/paths-filterwould needpull-requests: read, andrelease.ymldoesn't grant that to itsverifycall.Risk: skipped required checks pass.
iosandandroidare required checks, and GitHub counts a job skipped byif:as passing. If thechangesjob fails, both native jobs are skipped. The run still turns red, butchangesisn't a required check. Consider adding it to the ruleset.iOS caching.
COMPILATION_CACHE_ENABLE_CACHING=YESon thexcodebuildcommand line, which covers the app and every pod target. The CAS lives in<derivedDataPath>/CompilationCache.noindex(example/build/...) and is kept after the build.actions/cachepersists it under a key built from the Xcode build number,pnpm-lock.yaml,Podfile.lockand the native sources, with a restore key that falls back across source changes.ccache_enabled: Clang caching needs explicit modules and noC_COMPILER_LAUNCHER(swift-build).Cache hitand 6Cache missfor the C/ObjC/C++/Swift compile tasks.example/ios/Podsis cached byPodfile.lock. This saves about 75 s of prebuilt RN core, RN dependencies and Hermes tarball downloads.ruby/setup-rubyhasbundler-cache: true.macos-26instead ofmacos-latest, so a runner image switch can't silently invalidate the caches.macos-latestcurrently resolves to that image, with Xcode 26.6 (17F113).Gradle caching.
actions/setup-javainci.ymlande2e-android.ymlhascache: gradle. This uses the plainactions/cacheprovider.gradle/actions/setup-gradlewould default to its proprietary "enhanced" provider.Test plan
CI job wall times:
mainbefore #28iosandroidWarm
iosstep times: CAS restore 3 s (180 MB), Pods restore 12 s,pod install24 s (1m35s–2m without the caches, includingbundle install),xcodebuild48 s. Without the CAS,xcodebuildtook 1m50s–2m29s, and with a warm CAS 48 s–1m25s. Runner variance is large, so treat the CAS gain as roughly 30–60 s. Warmandroidstep times: 1.4 GB Gradle cache restore in about 30 s, thengradlew1m37s–1m52s instead of 3m24s–3m50s.changesscript against local merge commits: this branch givesios=true android=true, a README-only change givesfalse false, and a non-PR event givestrue true. The regexes are also covered by a file-by-file table (ios/…→ iOS only,example/android/…→ Android only,docs/…/e2e/…→ neither, lockfile → both).workflow_dispatchrun on this branch ran both jobs (run).xcodebuildcommand, clean DerivedData each time): no caching 24 s, caching with an empty CAS 35 s, caching with only the CAS kept 15.6 s.Not verified:
ci.yml, so both jobs run. The skip path is covered only by the local simulation above.e2e-androidwith the Gradle cache (label-gated, not run).Limitations
mainpushes, which always build both platforms. The warm numbers above come from re-runs of this PR.pnpm-lock.yaml,Podfile.lockor the Xcode build changes.--build-cache) could cover the plugin compile, butsetup-javasaves only when its key changes, so it would needsetup-gradle. That's not included here.