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
View File
@@ -28,10 +28,13 @@ jobs:
timeout-minutes: 45
container:
image: ${{ needs.preflight.outputs.IMAGE }}
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
env:
RUSTFLAGS: "-D warnings"
SKIP_WASM_BUILD: 1
CARGO_INCREMENTAL: 0
CARGO_TARGET_DIR: /cache/target
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
@@ -56,9 +59,12 @@ jobs:
timeout-minutes: 45
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
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4.1.7
+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
+12 -6
View File
@@ -26,6 +26,8 @@ jobs:
timeout-minutes: 60
container:
image: ${{ needs.preflight.outputs.IMAGE }}
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
RUST_BACKTRACE: 1
@@ -36,6 +38,7 @@ jobs:
# Temporary: Skip WASM build due to serde_core + Rust 1.88 + WASM bug
# Tracking: https://github.com/pezkuwichain/pezkuwi-sdk/issues/358
SKIP_WASM_BUILD: 1
CARGO_TARGET_DIR: /cache/target
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -53,6 +56,8 @@ jobs:
timeout-minutes: 60
container:
image: ${{ needs.preflight.outputs.IMAGE }}
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
env:
RUST_TOOLCHAIN: stable
# Enable debug assertions since we are running optimized builds for testing
@@ -61,6 +66,7 @@ jobs:
# Temporary: Skip WASM build due to serde_core + Rust 1.88 + WASM bug
# Tracking: https://github.com/pezkuwichain/pezkuwi-sdk/issues/358
SKIP_WASM_BUILD: 1
CARGO_TARGET_DIR: /cache/target
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -81,6 +87,8 @@ jobs:
container:
image: ${{ needs.preflight.outputs.IMAGE }}
options: --privileged
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
env:
RUST_TOOLCHAIN: stable
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
@@ -88,16 +96,11 @@ jobs:
# Temporary: Skip WASM build due to serde_core + Rust 1.88 + WASM bug
# Tracking: https://github.com/pezkuwichain/pezkuwi-sdk/issues/358
SKIP_WASM_BUILD: 1
CARGO_TARGET_DIR: /cache/target
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Rust Cache
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
shared-key: linux-stable-${{ matrix.partition }}
cache-on-failure: true
- name: Add wasm32v1-none target
run: rustup target add wasm32v1-none || true
@@ -128,6 +131,8 @@ jobs:
container:
image: ${{ needs.preflight.outputs.IMAGE }}
options: --privileged
volumes:
- /cache/cargo-target/pezkuwi-sdk:/cache/target
strategy:
fail-fast: false
matrix:
@@ -140,6 +145,7 @@ jobs:
# Temporary: Skip WASM build due to serde_core + Rust 1.88 + WASM bug
# Tracking: https://github.com/pezkuwichain/pezkuwi-sdk/issues/358
SKIP_WASM_BUILD: 1
CARGO_TARGET_DIR: /cache/target
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0