diff --git a/.github/actions/rust/action.yml b/.github/actions/rust/action.yml index efdc7eb8fa..780236b212 100644 --- a/.github/actions/rust/action.yml +++ b/.github/actions/rust/action.yml @@ -33,6 +33,20 @@ runs: components: ${{ inputs.components }} targets: ${{ inputs.targets }} + - name: Use sccache + uses: mozilla-actions/sccache-action@2e7f9ec7921547d4b46598398ca573513895d0bd # v0.0.4 + + - name: Enable sscache + shell: bash + run: | + echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" + echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV" + if [ "$GITHUB_WORKFLOW" ]; then + echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" + fi + echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" + echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" + - name: Set up MSVC (Windows) if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 @@ -58,28 +72,3 @@ runs: env: GITHUB_TOKEN: ${{ inputs.token }} run: cargo +${{ inputs.version }} quickinstall $(echo ${{ inputs.tools }} | tr -d ",") - - # sccache slows CI down, so we leave it disabled. - # Leaving the steps below commented out, so we can re-evaluate enabling it later. - # - name: Use sccache - # uses: mozilla-actions/sccache-action@2e7f9ec7921547d4b46598398ca573513895d0bd # v0.0.4 - - # - name: Enable sscache - # shell: bash - # run: | - # if [ "${{ runner.os }}" = "Windows" ]; then - # echo "CC=sccache cl" >> "$GITHUB_ENV" - # echo "CXX=sccache cl" >> "$GITHUB_ENV" - # else - # echo "CC=sccache cc" >> "$GITHUB_ENV" - # echo "CXX=sccache c++" >> "$GITHUB_ENV" - # fi - # echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" - # echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" - # echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" - - # Ditto for rust-cache. - # - name: Use Rust cache - # uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - # with: - # cache-all-crates: "true"