diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index c687c71..a55a77b 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -37,6 +37,19 @@ runs: restore-keys: | ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Sanitize components input + shell: bash + run: echo "SANITIZED_COMPONENTS=${{ inputs.components }}" | sed -E 's/, ?| /-/g' >> $GITHUB_ENV + + - name: Cache Rust toolchain + uses: actions/cache@v4 + with: + path: ~/.rustup + # Key includes the OS and the toolchain version (e.g., 'stable') + key: ${{ runner.os }}-rustup-${{ hashFiles('rust-toolchain.toml') }}-v1-${{ inputs.toolchain }}-${{ env.SANITIZED_COMPONENTS }} + restore-keys: | + ${{ runner.os }}-rustup- + - name: Cache cargo build (target) uses: actions/cache@v3 with: @@ -44,7 +57,6 @@ runs: key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - - name: Set up rust toolchain uses: dtolnay/rust-toolchain@stable with: