Skip to content

Cache Rust build artifacts in CI #222

@kwsantiago

Description

@kwsantiago

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:

  1. Broaden Swatinem/rust-cache workspaces to include the whole keep workspace, not just keep-mobile, so transitive crate builds are cached.
  2. 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
  3. 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.

Metadata

Metadata

Assignees

Labels

easyenhancementNew feature or requestgithub_actionsPull requests that update GitHub Actions codep2Priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions