Skip to content

Commit

Permalink
ci: Turn on sccache for Rust (#2121)
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert authored Sep 17, 2024
1 parent b70e5cf commit 17f5710
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions .github/actions/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 17f5710

Please sign in to comment.