feat: add persistent cargo target cache for self-hosted runners

Mount /cache/cargo-target/pezkuwi-sdk on VPS runners to reuse
compiled artifacts between workflow runs. This significantly
speeds up subsequent builds by avoiding full recompilation.

Updated workflows:
- checks.yml (cargo-clippy, check-try-runtime)
- docs.yml (test-doc, build-rustdoc)
- tests-linux-stable.yml (all test jobs)

Also removed Swatinem/rust-cache where persistent cache is used
since it's now redundant.
This commit is contained in:
2026-01-28 02:54:12 +03:00
parent 40aba02e1f
commit 245f09fb7c
4 changed files with 60 additions and 54 deletions
+6 -12
View File
@@ -25,19 +25,16 @@ jobs:
needs: [preflight]
container:
image: ${{ needs.preflight.outputs.IMAGE }}
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
env:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
SKIP_WASM_BUILD: 1
CARGO_INCREMENTAL: 0
CARGO_TARGET_DIR: /cache/target
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Rust Cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
shared-key: test-doc
cache-on-failure: true
# Exclude pezkuwi-zombienet-sdk-tests: its build.rs runs nested cargo build
# which doesn't inherit workspace [patch.crates-io] settings, causing
# serde_core duplicate lang item error. See: https://github.com/pezkuwichain/pezkuwi-sdk/issues/357
@@ -51,19 +48,16 @@ jobs:
needs: [preflight]
container:
image: ${{ needs.preflight.outputs.IMAGE }}
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
env:
SKIP_WASM_BUILD: 1
CARGO_INCREMENTAL: 0
CARGO_TARGET_DIR: /cache/target
RUSTDOCFLAGS: "-Dwarnings --default-theme=ayu --html-in-header ./docs/sdk/assets/header.html --extend-css ./docs/sdk/assets/theme.css --html-after-content ./docs/sdk/assets/after-content.html"
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Rust Cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
shared-key: build-rustdoc
cache-on-failure: true
# Exclude pezkuwi-zombienet-sdk-tests: nested cargo build in build.rs
# doesn't inherit workspace patches. See test-doc job comment.
- run: cargo doc --all-features --workspace --no-deps --locked --exclude pezkuwi-zombienet-sdk-tests