Problem
Every CI run rebuilds the Rust native libraries from scratch. On a clean runner this is a measurable chunk of each PR's wall time.
Proposal
ci.yml already uses Swatinem/rust-cache scoped to keep/keep-mobile, but does not cache the compiled .so outputs or the generated bindings, so build-rust.sh always redoes the cargo-ndk build and binding generation.
Extend the existing setup:
- Broaden
Swatinem/rust-cache workspaces to include the whole keep workspace, not just keep-mobile, so transitive crate builds are cached.
- Add an
actions/cache step for the build outputs:
- Paths:
app/src/main/jniLibs/, app/src/main/kotlin/io/privkey/keep/uniffi/
- Key: hash of
keep commit SHA + Cargo.lock + NDK version + TARGETS env
- On cache hit, skip the
./build-rust.sh step entirely.
Acceptance
- Cache hit on back-to-back PRs skips recompilation and binding generation
- Cache invalidates correctly when
keep SHA, Cargo.lock, or NDK version change
- Applies to both
ci.yml and release.yml
References
Follow-up from #221.
Problem
Every CI run rebuilds the Rust native libraries from scratch. On a clean runner this is a measurable chunk of each PR's wall time.
Proposal
ci.ymlalready usesSwatinem/rust-cachescoped tokeep/keep-mobile, but does not cache the compiled.sooutputs or the generated bindings, sobuild-rust.shalways redoes the cargo-ndk build and binding generation.Extend the existing setup:
Swatinem/rust-cacheworkspaces to include the whole keep workspace, not justkeep-mobile, so transitive crate builds are cached.actions/cachestep for the build outputs:app/src/main/jniLibs/,app/src/main/kotlin/io/privkey/keep/uniffi/keepcommit SHA +Cargo.lock+ NDK version +TARGETSenv./build-rust.shstep entirely.Acceptance
keepSHA,Cargo.lock, or NDK version changeci.ymlandrelease.ymlReferences
Swatinem/rust-cache: already wired inci.yml, extend rather than replaceactions/cache: for the compiled-output layerianthetechie/uniffi-starter: CI caches cargo and generated bindings in a similar sibling-workspace layoutFollow-up from #221.