diff --git a/.gitea/actions/rust-cache/action.yml b/.gitea/actions/rust-cache/action.yml index 909f643..7f1cb64 100644 --- a/.gitea/actions/rust-cache/action.yml +++ b/.gitea/actions/rust-cache/action.yml @@ -27,33 +27,6 @@ runs: echo "hash=$HASH" >> $GITHUB_OUTPUT echo "fingerprint=$HASH" >> $GITHUB_ENV - - name: Lookup cache (debug) - id: cache-lookup - uses: https://gitea.com/actions/cache@v3 - with: - path: ~/.cargo/registry - key: rust-linux-${{ steps.cache-key.outputs.hash }} - lookup-only: true - - - name: Show lookup result - shell: bash - run: | - echo "cache-hit (lookup): ${{ steps.cache-lookup.outputs.cache-hit }}" - echo "key used: rust-linux-${{ steps.cache-key.outputs.hash }}" - - - name: Cache cargo + rustup - id: cache - uses: https://gitea.com/actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.rustup/toolchains - ~/.rustup/settings.toml - target - key: rust-linux-${{ steps.cache-key.outputs.hash }} - restore-keys: rust-linux- - - name: Setup Rust shell: bash run: | @@ -63,9 +36,37 @@ runs: # Add cargo bin to PATH for subsequent steps echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - name: Show cached sizes + - name: Show sizes before cache shell: bash run: | echo "=== ~/.cargo ===" && du -sh ~/.cargo 2>/dev/null || echo "(empty)" echo "=== ~/.rustup ===" && du -sh ~/.rustup 2>/dev/null || echo "(empty)" - echo "=== target ===" && du -sh target 2>/dev/null || echo "(empty)" + + - name: Save cache + id: cache-save + uses: https://gitea.com/actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.rustup/toolchains + ~/.rustup/settings.toml + target + key: rust-linux-${{ steps.cache-key.outputs.hash }} + save-always: true + + - name: Lookup same key immediately after save + id: cache-lookup + uses: https://gitea.com/actions/cache@v3 + with: + path: ~/.cargo/registry + key: rust-linux-${{ steps.cache-key.outputs.hash }} + lookup-only: true + + - name: Show sizes after cache + shell: bash + run: | + echo "=== ~/.cargo ===" && du -sh ~/.cargo 2>/dev/null || echo "(empty)" + echo "=== ~/.rustup ===" && du -sh ~/.rustup 2>/dev/null || echo "(empty)" + echo "save result: ${{ steps.cache-save.outputs.cache-hit }}" + echo "lookup result: ${{ steps.cache-lookup.outputs.cache-hit }}"