Skip to content

ci: fix Rust caching and cut nightly build time - #738

Merged
Ziinc merged 1 commit into
mainfrom
claude/lucid-mayer-bd91xt
Oct 6, 2026
Merged

Ziinc merged 1 commit into
mainfrom
claude/lucid-mayer-bd91xt

Conversation

@Ziinc

@Ziinc Ziinc commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Nightly desktop builds were taking 17–27m per target and Android 21m. Every Rust job in the nightly compiled from scratch.

Root causes

  • The Rust cache never worked. refactor: remove Mission Control and dead terminal code; key agent columns "agent-<id>" #629 added a root workspace, so build output goes to ./target. nightly.yml, release.yml and remote-e2e.yml still cached src-tauri/target. Logs show No cache found and a 178 MB upload that holds only the cargo registry.
  • The cache key never changed. rust-cache hashed the orphaned src-tauri/Cargo.lock. Cargo uses the root Cargo.lock.
  • Cargo was ignoring the [profile.*] sections. Cargo only reads profiles from the workspace root, and since refactor: remove Mission Control and dead terminal code; key agent columns "agent-<id>" #629 they lived in src-tauri/Cargo.toml. It printed a warning: profiles for the non root package will be ignored. Release builds silently lost opt-level = "z", strip and panic = "abort", which telemetry.rs relies on.
  • Each LTO'd crate type gets its own whole-program link. With fat LTO, the lib's staticlib and cdylib outputs each take a full link: about 3.4m for the lib step plus about 3.8m for the bin on Linux.

Changes

  • rust-cache: workspaces: ". -> target" in nightly (×3), release and remote-e2e.
  • Delete src-tauri/Cargo.lock; fix the README make bump line that mentions it.
  • Move the profiles to the root Cargo.toml unchanged. This restores the pre-refactor: remove Mission Control and dead terminal code; key agent columns "agent-<id>" #629 behaviour.
  • Desktop nightly and release builds: a CI step rewrites crate-type to ["rlib"] before tauri build. Desktop only needs the bin; mobile and NAPI keep all three crate types.
  • Nightly desktop: lto = "thin" and codegen-units = 16 via env. Release keeps fat LTO from Cargo.toml, and its redundant env overrides and stale comment are removed.
  • Nightly Android and iOS debug builds compile dependencies at opt-level = 1, set by a CI-written .cargo/config.toml that overrides the manifest's 3.
  • Nightly Linux uses --bundles deb,rpm and skips the AppImage. Releases still build all bundles.

Side effects to note

  • Moving the profiles also brings back profile.dev.package."*" opt-level = 3 for local dev and ci.yml test builds. Dependencies compile slower on a cold cache, and tests run faster.
  • The first run after merge still starts cold, since this PR creates a new cache key. Gains show from the second run on.

Verification

  • cargo metadata --locked succeeds against the root lockfile, and the profile warning is gone.
  • A toy crate confirmed that .cargo/config.toml overrides profile.dev.package."*" in the manifest.
  • The sed + grep crate-type step was tested on a copy of src-tauri/Cargo.toml.
  • All edited workflows parse as YAML.
  • Not run: a full Tauri build. The container lacks webkit2gtk. A workflow_dispatch of Nightly on this branch is the real check.
    Not addressed here: the macOS x86_64 job failure in run 37449540162.
    Generated by Claude Code

- rust-cache pointed at src-tauri/target, but since the root workspace
  was added builds go to ./target, so nothing was ever cached. Point
  nightly, release and remote-e2e at ". -> target".
- Delete the orphaned src-tauri/Cargo.lock. Cargo uses the root lockfile,
  and rust-cache was hashing the stale one, freezing the cache key.
- Move [profile.*] to the root Cargo.toml. Cargo ignores profiles in
  non-root members, so release builds had silently lost opt-level "z",
  strip and panic = "abort".
- Desktop release/nightly builds compile only the rlib crate type,
  avoiding extra whole-program LTO links for staticlib/cdylib.
- Nightly desktop builds use thin LTO with 16 codegen units; tagged
  releases keep fat LTO.
- Nightly mobile debug builds compile dependencies at opt-level 1.
- Nightly Linux skips the AppImage bundle.
@Ziinc
Ziinc merged commit 4b360f6 into main Oct 6, 2026
37 of 38 checks passed
@Ziinc
Ziinc deleted the claude/lucid-mayer-bd91xt branch October 6, 2026 12:03

This branch was successfully deployed

1 active deployment
preview — 756907af Deployed Oct 6, 2026 by Ziinc via build #1712
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants