Skip to content

fix(ci): 为 Rust Core 与 Plugin SDK 工作流启用 rust-cache 与依赖缓存 - #204

Merged
xiaoyumuxi merged 1 commit into
mainfrom
ci/p0-faster-ci-and-thin-lto
Nov 26, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
ci/p0-faster-ci-and-thin-lto

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Contributor

Why

Observed on recent Lithe-core-rust CI runs and repository cache usage:

  • The repository cache held 6 entries total, of which 2 bare sdk-e2e rust/target caches consumed 6.60 GiB (3.30 GiB each).
  • Because of that quota pressure, rust-core.yml only cached ~/.cargo/registry (~34 MiB) on Linux and had no cache at all on macOS / Windows hosts jobs, forcing every PR to recompile all third-party dependencies from scratch (~7m 21s on Linux alone).
  • plugins-verify.yml also lacked caching for sdk-rust, sdk-java (Maven), and sdk-node (npm).

Changes

  • .github/workflows/rust-core.yml:
    • Replace the registry-only actions/cache@v6 on linux with Swatinem/rust-cache@v2 (workspaces: rust -> target, shared-key: rust-core-linux, cache-on-failure: true), caching third-party dependency .rlibs while stripping workspace artifacts to stay well within the 10 GiB cache quota.
    • Add Swatinem/rust-cache@v2 (workspaces: rust -> target, shared-key: rust-core-host, cache-on-failure: true) to the macOS / Windows hosts job.
  • .github/workflows/plugins-verify.yml:
    • Replace the bare rust/target + shared/plugins/sdk/rust/target actions/cache@v6 in sdk-e2e with Swatinem/rust-cache@v2 (shared-key: sdk-e2e) to reclaim the 6.6 GiB cache footprint.
    • Add Swatinem/rust-cache@v2 to sdk-rust, cache: maven to sdk-java / sdk-e2e Java 21 setup, and cache: npm to sdk-node / sdk-e2e Node setup.

Note on Release LTO

We benchmarked lto = "thin" + codegen-units = 16 vs current lto = true + codegen-units = 1 on lithe-core staticlib (macOS arm64 release):

  • lto = true, cgu = 1: 151s, liblithe_core.a = 42.1 MB (13.9 MB gzipped)
  • lto = "thin", cgu = 16: 35s, liblithe_core.a = 102.7 MB (22.1 MB gzipped)

To preserve minimal release artifact size while accelerating desktop releases via staged Core caching (in the companion Lithe-IDEA PR), rust/Cargo.toml keeps lto = true and codegen-units = 1 unchanged.

Verification

  • ruby -ryaml syntax check on .github/workflows/rust-core.yml and .github/workflows/plugins-verify.yml: passed.
  • node --test scripts/rust-core/*.test.mjs: 16/16 passed.
  • node scripts/rust-core/verify-platform-tests.mjs: passed across all 53 crates.

@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 26, 2026 12:57
@xiaoyumuxi
xiaoyumuxi merged commit 0d28c10 into main Nov 26, 2026
7 of 8 checks passed
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.

1 participant