diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 63c882bf7b0cf447bfd641002bcf67667bbea8b6..81e38d0b6c66f5dabc704a84b432806edb1cf664 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -62,6 +62,12 @@ jobs: if: github.repository_owner == 'zed-industries' runs-on: namespace-profile-4x8-ubuntu-2204 steps: + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action + with: + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: @@ -145,6 +151,12 @@ jobs: - name: steps::install_mold run: ./script/install-mold shell: bash -euxo pipefail {0} + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action + with: + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: steps::setup_node uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 with: @@ -214,10 +226,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - - name: steps::cache_rust_dependencies - uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action with: - save-if: ${{ github.ref == 'refs/heads/main' }} + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: steps::setup_linux run: ./script/linux shell: bash -euxo pipefail {0} @@ -261,6 +275,12 @@ jobs: - name: steps::install_mold run: ./script/install-mold shell: bash -euxo pipefail {0} + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action + with: + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: cargo build -p collab run: cargo build -p collab shell: bash -euxo pipefail {0} @@ -317,6 +337,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action + with: + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: run_tests::check_dependencies::install_cargo_machete uses: clechasseur/rs-cargo@8435b10f6e71c2e3d4d3b7573003a8ce4bfc6386 with: @@ -350,10 +376,12 @@ jobs: mkdir -p ./../.cargo cp ./.cargo/ci-config.toml ./../.cargo/config.toml shell: bash -euxo pipefail {0} - - name: steps::cache_rust_dependencies - uses: swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action with: - save-if: ${{ github.ref == 'refs/heads/main' }} + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: run_tests::check_docs::lychee_link_check uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 with: @@ -392,6 +420,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false + - name: steps::cache_rust_dependencies_namespace + uses: namespacelabs/rust-cache@nscloud-cache-action + with: + path: + - /home/runner/.cargo/bin/cargo-nextest + - /home/runner/.cargo/bin/cargo-about - name: ./script/check-licenses run: ./script/check-licenses shell: bash -euxo pipefail {0} diff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rs index 3328d857fb22e174a0e452626e0caf54b58065de..8df95c1ab38bb8ecf9e83bd764095b857b40f648 100644 --- a/tooling/xtask/src/tasks/workflows/run_tests.rs +++ b/tooling/xtask/src/tasks/workflows/run_tests.rs @@ -225,6 +225,7 @@ fn check_style() -> NamedJob { named::job( release_job(&[]) .runs_on(runners::LINUX_MEDIUM) + .add_step(steps::cache_rust_dependencies_namespace()) .add_step(steps::checkout_repo()) .add_step(steps::setup_pnpm()) .add_step(steps::script("./script/prettier")) @@ -273,6 +274,7 @@ fn check_dependencies() -> NamedJob { release_job(&[]) .runs_on(runners::LINUX_SMALL) .add_step(steps::checkout_repo()) + .add_step(steps::cache_rust_dependencies_namespace()) .add_step(install_cargo_machete()) .add_step(run_cargo_machete()) .add_step(check_cargo_lock()) @@ -287,6 +289,7 @@ fn check_workspace_binaries() -> NamedJob { .add_step(steps::checkout_repo()) .add_step(steps::setup_cargo_config(Platform::Linux)) .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 --workspace --bins --examples")) .add_step(steps::cleanup_cargo_config(Platform::Linux)), @@ -312,6 +315,9 @@ pub(crate) fn run_platform_tests(platform: Platform) -> NamedJob { platform == Platform::Linux, 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::clippy(platform)) .add_step(steps::cargo_install_nextest(platform)) @@ -371,7 +377,7 @@ fn doctests() -> NamedJob { release_job(&[]) .runs_on(runners::LINUX_DEFAULT) .add_step(steps::checkout_repo()) - .add_step(steps::cache_rust_dependencies()) + .add_step(steps::cache_rust_dependencies_namespace()) .map(steps::install_linux_dependencies) .add_step(steps::setup_cargo_config(Platform::Linux)) .add_step(run_doctests()) @@ -384,6 +390,7 @@ fn check_licenses() -> NamedJob { Job::default() .runs_on(runners::LINUX_SMALL) .add_step(steps::checkout_repo()) + .add_step(steps::cache_rust_dependencies_namespace()) .add_step(steps::script("./script/check-licenses")) .add_step(steps::script("./script/generate-licenses")), ) @@ -423,7 +430,7 @@ fn check_docs() -> NamedJob { .add_step(steps::checkout_repo()) .add_step(steps::setup_cargo_config(Platform::Linux)) // todo(ci): un-inline build_docs/action.yml here - .add_step(steps::cache_rust_dependencies()) + .add_step(steps::cache_rust_dependencies_namespace()) .add_step( lychee_link_check("./docs/src/**/*"), // check markdown links ) diff --git a/tooling/xtask/src/tasks/workflows/steps.rs b/tooling/xtask/src/tasks/workflows/steps.rs index 14ee5cc5b50a464d1fcc54d7497906926f85321e..5feaeb0137882a715dc3dd0cab7bf69a286852bd 100644 --- a/tooling/xtask/src/tasks/workflows/steps.rs +++ b/tooling/xtask/src/tasks/workflows/steps.rs @@ -112,13 +112,21 @@ pub(crate) fn clippy(platform: Platform) -> Step { } } -pub(crate) fn cache_rust_dependencies() -> Step { +pub(crate) fn cache_rust_dependencies_namespace() -> Step { named::uses( - "swatinem", + "namespacelabs", "rust-cache", - "9d47c6ad4b02e050fd481d890b2ea34778fd09d6", // v2 + "nscloud-cache-action", // v2 ) .with(("save-if", "${{ github.ref == 'refs/heads/main' }}")) + .with(("cache", "rust")) + .with(( + "path", + [ + "/home/runner/.cargo/bin/cargo-nextest", + "/home/runner/.cargo/bin/cargo-about", + ], + )) } fn setup_linux() -> Step {