ci: Enable namespace caching for Linux workers (#41652)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz
2025-11-03 21:07:36 +01:00
committed by GitHub
parent 08daedd014
commit 8217e57a2d
3 changed files with 37 additions and 15 deletions
+26 -6
View File
@@ -66,6 +66,10 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:
clean: false clean: false
- name: steps::cache_rust_dependencies_namespace
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
- name: steps::setup_pnpm - name: steps::setup_pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
with: with:
@@ -145,6 +149,10 @@ jobs:
- name: steps::install_mold - name: steps::install_mold
run: ./script/install-mold run: ./script/install-mold
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
- name: steps::cache_rust_dependencies_namespace
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
- name: steps::setup_node - name: steps::setup_node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with: with:
@@ -214,10 +222,10 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:
clean: false clean: false
- name: steps::cache_rust_dependencies - name: steps::cache_rust_dependencies_namespace
uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 uses: namespacelabs/nscloud-cache-action@v1
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} cache: rust
- name: steps::setup_linux - name: steps::setup_linux
run: ./script/linux run: ./script/linux
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
@@ -261,6 +269,10 @@ jobs:
- name: steps::install_mold - name: steps::install_mold
run: ./script/install-mold run: ./script/install-mold
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
- name: steps::cache_rust_dependencies_namespace
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
- name: cargo build -p collab - name: cargo build -p collab
run: cargo build -p collab run: cargo build -p collab
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
@@ -317,6 +329,10 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:
clean: false clean: false
- name: steps::cache_rust_dependencies_namespace
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
- name: run_tests::check_dependencies::install_cargo_machete - name: run_tests::check_dependencies::install_cargo_machete
uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386
with: with:
@@ -350,10 +366,10 @@ jobs:
mkdir -p ./../.cargo mkdir -p ./../.cargo
cp ./.cargo/ci-config.toml ./../.cargo/config.toml cp ./.cargo/ci-config.toml ./../.cargo/config.toml
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
- name: steps::cache_rust_dependencies - name: steps::cache_rust_dependencies_namespace
uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 uses: namespacelabs/nscloud-cache-action@v1
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} cache: rust
- name: run_tests::check_docs::lychee_link_check - name: run_tests::check_docs::lychee_link_check
uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
with: with:
@@ -392,6 +408,10 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:
clean: false clean: false
- name: steps::cache_rust_dependencies_namespace
uses: namespacelabs/nscloud-cache-action@v1
with:
cache: rust
- name: ./script/check-licenses - name: ./script/check-licenses
run: ./script/check-licenses run: ./script/check-licenses
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
@@ -229,6 +229,7 @@ fn check_style() -> NamedJob {
release_job(&[]) release_job(&[])
.runs_on(runners::LINUX_MEDIUM) .runs_on(runners::LINUX_MEDIUM)
.add_step(steps::checkout_repo()) .add_step(steps::checkout_repo())
.add_step(steps::cache_rust_dependencies_namespace())
.add_step(steps::setup_pnpm()) .add_step(steps::setup_pnpm())
.add_step(steps::script("./script/prettier")) .add_step(steps::script("./script/prettier"))
.add_step(steps::script("./script/check-todos")) .add_step(steps::script("./script/check-todos"))
@@ -276,6 +277,7 @@ fn check_dependencies() -> NamedJob {
release_job(&[]) release_job(&[])
.runs_on(runners::LINUX_SMALL) .runs_on(runners::LINUX_SMALL)
.add_step(steps::checkout_repo()) .add_step(steps::checkout_repo())
.add_step(steps::cache_rust_dependencies_namespace())
.add_step(install_cargo_machete()) .add_step(install_cargo_machete())
.add_step(run_cargo_machete()) .add_step(run_cargo_machete())
.add_step(check_cargo_lock()) .add_step(check_cargo_lock())
@@ -290,6 +292,7 @@ fn check_workspace_binaries() -> NamedJob {
.add_step(steps::checkout_repo()) .add_step(steps::checkout_repo())
.add_step(steps::setup_cargo_config(Platform::Linux)) .add_step(steps::setup_cargo_config(Platform::Linux))
.map(steps::install_linux_dependencies) .map(steps::install_linux_dependencies)
.add_step(steps::cache_rust_dependencies_namespace())
.add_step(steps::script("cargo build -p collab")) .add_step(steps::script("cargo build -p collab"))
.add_step(steps::script("cargo build --workspace --bins --examples")) .add_step(steps::script("cargo build --workspace --bins --examples"))
.add_step(steps::cleanup_cargo_config(Platform::Linux)), .add_step(steps::cleanup_cargo_config(Platform::Linux)),
@@ -312,6 +315,9 @@ pub(crate) fn run_platform_tests(platform: Platform) -> NamedJob {
platform == Platform::Linux, platform == Platform::Linux,
steps::install_linux_dependencies, steps::install_linux_dependencies,
) )
.when(platform == Platform::Linux, |this| {
this.add_step(steps::cache_rust_dependencies_namespace())
})
.add_step(steps::setup_node()) .add_step(steps::setup_node())
.add_step(steps::clippy(platform)) .add_step(steps::clippy(platform))
.add_step(steps::cargo_install_nextest(platform)) .add_step(steps::cargo_install_nextest(platform))
@@ -371,7 +377,7 @@ fn doctests() -> NamedJob {
release_job(&[]) release_job(&[])
.runs_on(runners::LINUX_DEFAULT) .runs_on(runners::LINUX_DEFAULT)
.add_step(steps::checkout_repo()) .add_step(steps::checkout_repo())
.add_step(steps::cache_rust_dependencies()) .add_step(steps::cache_rust_dependencies_namespace())
.map(steps::install_linux_dependencies) .map(steps::install_linux_dependencies)
.add_step(steps::setup_cargo_config(Platform::Linux)) .add_step(steps::setup_cargo_config(Platform::Linux))
.add_step(run_doctests()) .add_step(run_doctests())
@@ -384,6 +390,7 @@ fn check_licenses() -> NamedJob {
Job::default() Job::default()
.runs_on(runners::LINUX_SMALL) .runs_on(runners::LINUX_SMALL)
.add_step(steps::checkout_repo()) .add_step(steps::checkout_repo())
.add_step(steps::cache_rust_dependencies_namespace())
.add_step(steps::script("./script/check-licenses")) .add_step(steps::script("./script/check-licenses"))
.add_step(steps::script("./script/generate-licenses")), .add_step(steps::script("./script/generate-licenses")),
) )
@@ -423,7 +430,7 @@ fn check_docs() -> NamedJob {
.add_step(steps::checkout_repo()) .add_step(steps::checkout_repo())
.add_step(steps::setup_cargo_config(Platform::Linux)) .add_step(steps::setup_cargo_config(Platform::Linux))
// todo(ci): un-inline build_docs/action.yml here // todo(ci): un-inline build_docs/action.yml here
.add_step(steps::cache_rust_dependencies()) .add_step(steps::cache_rust_dependencies_namespace())
.add_step( .add_step(
lychee_link_check("./docs/src/**/*"), // check markdown links lychee_link_check("./docs/src/**/*"), // check markdown links
) )
+2 -7
View File
@@ -101,13 +101,8 @@ pub(crate) fn clippy(platform: Platform) -> Step<Run> {
} }
} }
pub(crate) fn cache_rust_dependencies() -> Step<Use> { pub(crate) fn cache_rust_dependencies_namespace() -> Step<Use> {
named::uses( named::uses("namespacelabs", "nscloud-cache-action", "v1").add_with(("cache", "rust"))
"swatinem",
"rust-cache",
"9d47c6ad4b02e050fd481d890b2ea34778fd09d6", // v2
)
.with(("save-if", "${{ github.ref == 'refs/heads/main' }}"))
} }
fn setup_linux() -> Step<Run> { fn setup_linux() -> Step<Run> {