Skip to content
Merged
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ jobs:
run: |
if [[ "${RUNNER_OS}" == "Linux" ]]; then
cargo_target_dir="${HOME}/actions-runner/_work/target"
elif [[ "${RUNNER_OS}" == "Windows" && -d "C:/actions-runner/_work" ]]; then
cargo_target_dir="C:/actions-runner/_work/target"
else
# Forward slashes keep the Windows path compatible with Cargo,
# PowerShell, GitHub Actions, and Git Bash filesystem commands.
Expand All @@ -117,15 +119,21 @@ jobs:

- &configure-sccache
name: Configure sccache
if: runner.os == 'Linux'
shell: bash
run: |
if command -v sccache >/dev/null 2>&1; then
if [[ "${RUNNER_OS}" == "Windows" ]]; then
sccache_bin="C:/sccache/sccache.exe"
sccache_dir="C:/actions-runner/_work/sccache"
else
sccache_bin="$(command -v sccache)"
sccache_dir="${HOME}/.cache/sccache"
fi
# sccache cannot cache incremental compilation artifacts, so
# disable Cargo's incremental mode whenever the wrapper is active.
echo "CARGO_INCREMENTAL=0" >>"${GITHUB_ENV}"
echo "RUSTC_WRAPPER=/usr/local/bin/sccache" >>"${GITHUB_ENV}"
echo "SCCACHE_DIR=${HOME}/.cache/sccache" >>"${GITHUB_ENV}"
echo "RUSTC_WRAPPER=${sccache_bin}" >>"${GITHUB_ENV}"
echo "SCCACHE_DIR=${sccache_dir}" >>"${GITHUB_ENV}"
echo "SCCACHE_CACHE_SIZE=20G" >>"${GITHUB_ENV}"
fi

Expand Down Expand Up @@ -243,13 +251,13 @@ jobs:

- &show-sccache-stats
name: Show sccache statistics
if: always() && runner.os == 'Linux'
if: always()
shell: bash
run: |
if command -v sccache >/dev/null 2>&1; then
sccache --show-stats
else
echo "::notice::sccache is not installed on this Linux runner"
echo "::notice::sccache is not installed on this ${RUNNER_OS} runner"
fi

- name: Upload Cargo timing reports
Expand Down
Loading