fix(ci): hash the library sources in the native build tasks - #2
Merged
Conversation
Both build:android and build:ios only exist as scripts in the example package, so every bare input glob resolved inside example/. The library's own src/, android/, ios/, podspec and nitro.json were not hashed at all, and the example/* entries pointed at example/example/*. Editing the Nitro spec or the Kotlin and Swift sources left both task hashes untouched, so CI reported a cache HIT and skipped the JDK, CocoaPods and build steps. Reach the root files through $TURBO_ROOT$ and widen the example globs to the whole source tree.
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.
The bug
build:androidandbuild:iosonly exist as scripts inexample/package.json, so Turborepo runs them in theexamplepackage and resolves every bare input glob relative toexample/. That makes the wholeinputslist inturbo.jsonpoint at the wrong tree:"src/*.ts","src/*.tsx"resolved toexample/src/*.ts(x)and matched exactly one file,example/src/App.tsx"android","ios","*.podspec","package.json"resolved insideexample/"example/package.json","example/android","example/ios"resolved toexample/example/..., which does not existSo the library's own sources were never hashed: not
src/, not the Nitro spec, not the Kotlin or Swift files, notnitro.json, not the podspec.turbo run build:* --dry=jsononmainlisted 28 inputs for Android, all of them underexample/. Appending a line to each of these files and re-reading the task hash left both hashes untouched:src/specs/SharedTransitionModule.nitro.ts2890f3fd0ac0a842250f38a614ae0559src/native/NativeModule.ts2890f3fd0ac0a842250f38a614ae0559src/TransitionCoordinator.ts2890f3fd0ac0a842250f38a614ae0559android/.../HybridSharedTransitionModule.kt2890f3fd0ac0a842250f38a614ae0559ios/HybridSharedTransitionModule.swift2890f3fd0ac0a842250f38a614ae0559nitro.json2890f3fd0ac0a842250f38a614ae0559Those are the unchanged baseline hashes in every row.
.github/workflows/ci.ymlgates the expensive work on that hash: aHITsetsturbo_cache_hit=1, which skips the JDK install, the Android SDK licence step, the Xcode selection andpod install, and letsturbo run build:*replay from cache. A pull request that rewrites the Nitro spec or the native Kotlin/Swift module therefore reports both native builds green without compiling anything.The fix
Root files are reached with the
$TURBO_ROOT$prefix (Turborepo 2.1+, this repo is on 2.7.2), and the example globs widened fromsrc/*.ts(x)tosrc/**so the nested screens, components and navigation files count too. Build output directories stay excluded.Verification
Same probe after the change, against the new baselines
ab47d59fc30531e0(Android) and99ce437c92e23cd5(iOS):src/specs/SharedTransitionModule.nitro.tssrc/native/NativeModule.tssrc/TransitionCoordinator.tsandroid/.../HybridSharedTransitionModule.ktios/HybridSharedTransitionModule.swiftnitro.jsonSharedTransition.podspecexample/src/screens/DetailScreen.tsxPlatform-specific native sources now invalidate only their own build, shared TypeScript and Nitro config invalidate both. The resolved iOS input list grew from 28 to 57 entries and includes
../src/specs/SharedTransitionModule.nitro.ts,../ios/HybridSharedTransitionModule.swift,../nitro.jsonand../SharedTransition.podspec.yarn test,yarn lintandyarn typecheckare clean.