Cache cargo installs in Gitea CI
Assisted-by: GLM-5 via pi
change yswqkmpyxwtwrnnnyyukntsppunpokky
commit 8cf6d971d112ef497e9b6433eaa8f7b0cee0fd98
author Alpha Chen <alpha@kejadlen.dev>
date
parent llymtvor
diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index 82f6a30..f8b9f98 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -14,8 +14,23 @@ jobs:
       - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
         with:
           persist-credentials: false
+
       - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
       - run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
+
+      - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
+        with:
+          path: |
+            ~/.cargo/bin/
+            ~/.cargo/registry/index/
+            ~/.cargo/registry/cache/
+            ~/.cargo/git/db/
+            target/
+          # Cache key is Cargo.lock, which means cargo install'ed tools (grcov, just)
+          # may be stale after a cache hit. Bump the suffix to force a cache bust.
+          key: cargo-${{ runner.os }}-v1-${{ hashFiles('Cargo.lock') }}
+          restore-keys: cargo-${{ runner.os }}-
+
       - run: rustup component add clippy rustfmt llvm-tools
       - run: cargo install grcov
       - run: cargo install just