Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Turn on sccache for Rust #2121

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading