Aventuras/scripts
Tony Frazier 84db0be979
Some checks failed
CI / build-ios (push) Waiting to run
CI / build-android (push) Waiting to run
CI / build-desktop (push) Waiting to run
Rust Lint / Format (push) Has been cancelled
Rust Lint / Clippy (push) Has been cancelled
Key Rust caches on the dependency set and stop caching Gradle (#612)
## Summary

The repository's Actions caches reached 9.57 GB of GitHub's 10 GB quota,
and the Rust caches had roughly doubled in ten days. When `Cargo.lock`
changes, rust-cache restores the previous entry as a fallback, cargo
builds the new dependency versions beside the old ones, and the save
keeps both, because its cleanup matches artifacts by crate name only.
Every dependency update stacked another generation onto every platform's
cache.

This change puts a hash of the Rust dependency set into each rust-cache
`key`. The key is part of rust-cache's restore prefix, so a dependency
change has nothing to fall back to: it builds cold once per platform,
and each saved entry holds a single generation. It also stops caching
Gradle, whose 843 MB entry only saved dependency downloads.

## Changes

- **`scripts/ci/cargo-deps-hash.js`** prints the first 16 hex characters
of a SHA-256 over `Cargo.lock`'s registry and git packages (dropping the
`aventura` workspace crate) and `src-tauri/Cargo.toml` without its
`[package]` version line. A release version bump leaves it unchanged; a
dependency version, feature or profile change does not.
- **`.github/actions/rust-cache`** (new composite action) runs the
script and calls `swatinem/rust-cache@v2` with `key: <key>-<hash>`,
`workspaces: '<working-directory>/src-tauri -> target'` and `save-if` on
`master` only. If the script fails, the step fails rather than saving
under a key without the hash. Inputs: `key`, `working-directory`
(default `.`) and `cache-directories`.
- **Every rust-cache step uses the action:** `build-desktop.yml`
(`<target>-<hash>`, with the Dev Drive path as `working-directory`),
`build-android.yml` (`android-v2-<hash>`, still persisting the generated
Kotlin), `build-ios.yml` (`ios-<hash>`) and `rust-lint.yml`'s Clippy job
(`clippy-<hash>`). `rust-lint.yml` also runs when the script or the
action changes.
- **Gradle is not cached.** `setup-gradle` keeps `cache-provider: basic`
and adds `cache-disabled: true`, so it still validates the wrapper and
writes the job summary.
- **`docs/development/ci-caching.md`** (new) records what each cache
holds and why it is configured that way: the diagnostic runs, how
rust-cache keys, restores and prunes, the options weighed against the
dependency hash, the Gradle provider comparison, and the decision to
keep `armv7`. `release.md` keeps the rules and links there, and its
generated-Kotlin explanation moves there. `ci.yml`'s comments,
`ios-build-target.md` and `docs/README.md` are updated to match.

### Effect

- The first `master` run after this merges, and the first after any
later dependency, feature or profile change, builds every Rust cache
cold. A PR that makes such a change also builds cold.
- Release runs keep hitting: the version bump changes neither this hash
nor rust-cache's own lock hash.
- The existing, oversized entries stay until GitHub evicts them as least
recently used. Deleting them by hand (`gh cache list --key v0-rust-`,
then `gh cache delete <id>`) frees the space right away.
- Android runs download the Gradle distribution and dependencies each
time.

## Testing

- New unit tests for `cargoDepsHash`: unchanged by an app version bump
and by CRLF line endings, changed by a registry package version and by a
dependency feature.
- `node scripts/ci/cargo-deps-hash.js` on this branch prints
`8cdb41fe24f6ce46`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01AhkosChqt73QngC3UqQB9C


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Android, desktop, iOS, and Rust lint workflows now use shared Rust
caching that reflects dependency changes.
  * Android builds no longer cache Gradle data.
  * CI workflow descriptions now reflect the updated cache behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:31:21 -04:00
..
ci Key Rust caches on the dependency set and stop caching Gradle (#612) 2026-10-11 21:31:21 -04:00
android-setup.sh Current 2026-01-01 14:55:31 -07:00
build-ios-unsigned.sh iOS follow-ups: iPadOS detection, backup restore, app icon, and a first pass of iOS bug fixes (#559) 2026-10-09 10:56:10 -04:00
check_migrations.js Fix CRLF Migrations (#162) 2026-02-22 15:46:59 -05:00
check_wry_injection.js Add Incognito Keyboard option for Android (#467) 2026-08-26 20:45:30 -04:00
fake-provider.mjs Make the errors surface in the activity report (#569) 2026-10-06 10:28:37 -04:00
package-manager.js Route dev/build/release scripts through aube when it installed node_modules (#552) 2026-09-28 14:34:27 -04:00
package-manager.test.js Route dev/build/release scripts through aube when it installed node_modules (#552) 2026-09-28 14:34:27 -04:00
pm.js Route dev/build/release scripts through aube when it installed node_modules (#552) 2026-09-28 14:34:27 -04:00
release.js Run Clippy on push and in CI, and split lint into lint:ts and lint:rust (#608) 2026-10-11 14:50:50 -04:00
remote.js Release script: push over the contributor's own remote instead of a hardcoded HTTPS URL (#432) 2026-08-08 22:08:59 +02:00
remote.test.js Release script: push over the contributor's own remote instead of a hardcoded HTTPS URL (#432) 2026-08-08 22:08:59 +02:00
sync-ios-icons.sh iOS follow-ups: iPadOS detection, backup restore, app icon, and a first pass of iOS bug fixes (#559) 2026-10-09 10:56:10 -04:00
version.js Overhaul CI/CD: Node 24, shared release workflows, faster cached builds (#518) 2026-09-16 22:38:32 -04:00
version.test.js Validated release script, extracted version arithmetic, lint config fixes (#416) 2026-08-08 19:55:23 +02:00