ci: Enable namespace caching for clippy on Mac (#47819)

Piotr Osiewicz created

Release Notes:

- N/A

Change summary

.github/workflows/release.yml                  | 5 +++++
.github/workflows/run_tests.yml                | 5 +++++
tooling/xtask/src/tasks/workflows/run_tests.rs | 7 ++++---
3 files changed, 14 insertions(+), 3 deletions(-)

Detailed changes

.github/workflows/release.yml 🔗

@@ -140,6 +140,11 @@ jobs:
         mkdir -p ./../.cargo
         cp ./.cargo/ci-config.toml ./../.cargo/config.toml
       shell: bash -euxo pipefail {0}
+    - name: steps::cache_rust_dependencies_namespace
+      uses: namespacelabs/nscloud-cache-action@v1
+      with:
+        cache: rust
+        path: ~/.rustup
     - name: steps::clippy
       run: ./script/clippy
       shell: bash -euxo pipefail {0}

.github/workflows/run_tests.yml 🔗

@@ -159,6 +159,11 @@ jobs:
         mkdir -p ./../.cargo
         cp ./.cargo/ci-config.toml ./../.cargo/config.toml
       shell: bash -euxo pipefail {0}
+    - name: steps::cache_rust_dependencies_namespace
+      uses: namespacelabs/nscloud-cache-action@v1
+      with:
+        cache: rust
+        path: ~/.rustup
     - name: steps::clippy
       run: ./script/clippy
       shell: bash -euxo pipefail {0}

tooling/xtask/src/tasks/workflows/run_tests.rs 🔗

@@ -320,9 +320,10 @@ pub(crate) fn clippy(platform: Platform) -> NamedJob {
             .runs_on(runner)
             .add_step(steps::checkout_repo())
             .add_step(steps::setup_cargo_config(platform))
-            .when(platform == Platform::Linux, |this| {
-                this.add_step(steps::cache_rust_dependencies_namespace())
-            })
+            .when(
+                platform == Platform::Linux || platform == Platform::Mac,
+                |this| this.add_step(steps::cache_rust_dependencies_namespace()),
+            )
             .when(
                 platform == Platform::Linux,
                 steps::install_linux_dependencies,