name: Rust Setup + Cache description: Install Rust toolchain and cache cargo/rustup dependencies for Gitea Actions author: eric inputs: toolchain: description: Rust toolchain to install (e.g., stable, 1.75.0, nightly) default: stable required: false outputs: cache-hit: description: "Whether a cache entry was found" value: ${{ steps.cache.outputs.cache-hit }} runs: using: composite steps: - 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-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/Cargo.toml') }} restore-keys: | rust-linux-${{ hashFiles('**/Cargo.lock') }}- rust-linux- - name: Setup Rust shell: bash run: | # If toolchain was cached, rustup will skip download — install still runs for metadata curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | sh -s -- -y --default-toolchain ${{ inputs.toolchain }} # Add cargo bin to PATH for subsequent steps echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: Show cached sizes 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)"