summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGangzheng Tong <tonggangzheng@gmail.com>2025-09-04 19:46:19 -0700
committerGitHub <noreply@github.com>2025-09-04 19:46:19 -0700
commit1e1ff8a1254c114f261271ffe5580183b8402e32 (patch)
tree177ccb89a90f31d5e6eab0a72c8a4788b5cbcdf3
parent0fb62524bc8beda70694f6c58570ad8096bbe698 (diff)
Fix cache_dir path for ccache config (#8370)
Previously we are missing `ccache --set-config=cache_dir="$ccache_dir"` and the build was using the default cache_dir. This PR fixed that and the cache are hit in reruns. ``` 📊 ccache statistics (post-build): Cacheable calls: 1198 / 1198 (100.0%) Hits: 1195 / 1198 (99.75%) Direct: 1193 / 1195 (99.83%) Preprocessed: 2 / 1195 ( 0.17%) Misses: 3 / 1198 ( 0.25%) Local storage: Cache size (GiB): 0.6 / 5.0 (11.11%) Hits: 1195 / 1198 (99.75%) Misses: 3 / 1198 ( 0.25%) ```
-rw-r--r--.github/actions/common-setup/action.yml17
-rw-r--r--.github/workflows/ci-slang-build.yml3
2 files changed, 9 insertions, 11 deletions
diff --git a/.github/actions/common-setup/action.yml b/.github/actions/common-setup/action.yml
index 1ab2d1a48..5f4bac02c 100644
--- a/.github/actions/common-setup/action.yml
+++ b/.github/actions/common-setup/action.yml
@@ -150,26 +150,25 @@ runs:
echo "✅ ccache found on self-hosted runner - setting up persistent caching"
# Set ccache directory to a persistent location outside workspace
- # Use runner temp directory with a unique path per repo/compiler/platform
- ccache_base_dir="${RUNNER_TEMP:-/tmp}/ccache-slang"
+ if [[ "${{ inputs.os }}" == "windows" ]]; then
+ ccache_base_dir="C:/ccache-slang"
+ else
+ # Linux/macOS: Use home directory for persistence
+ ccache_base_dir="$HOME/.ccache-slang"
+ fi
ccache_dir="$ccache_base_dir/${{ inputs.os }}-${{ inputs.compiler }}-${{ inputs.platform }}"
mkdir -p "$ccache_dir"
echo "CCACHE_DIR=$ccache_dir" >> $GITHUB_ENV
echo "🔧 Using persistent ccache directory: $ccache_dir"
# Configure ccache settings for local use only
- ccache --set-config=max_size=2G
+ ccache --set-config=max_size=20G
ccache --set-config=compression=true
ccache --set-config=compression_level=6
ccache --set-config=sloppiness=pch_defines,time_macros
+ ccache --set-config=cache_dir="$ccache_dir"
# Enable ccache for CMake (set environment variables)
# Get the full path to ccache executable
ccache_path=$(which ccache)
echo "ccache_symlinks_path=$ccache_path" >> $GITHUB_ENV
-
- # Show initial stats
- echo "ccache configuration:"
- ccache --show-config || echo "Could not show ccache config"
- ccache --zero-stats || echo "Could not zero ccache stats"
- ccache --show-stats || echo "Could not show ccache stats"
diff --git a/.github/workflows/ci-slang-build.yml b/.github/workflows/ci-slang-build.yml
index 6831f3d21..b5a492543 100644
--- a/.github/workflows/ci-slang-build.yml
+++ b/.github/workflows/ci-slang-build.yml
@@ -114,6 +114,7 @@ jobs:
cmake_launcher_defines=()
if [[ -n "${ccache_symlinks_path:-}" ]]; then
echo "🔧 Using ccache with launcher: ${ccache_symlinks_path}"
+ echo "🔧 CCACHE_DIR is set to: ${CCACHE_DIR:-'not set'}"
cmake_launcher_defines+=("-DCMAKE_C_COMPILER_LAUNCHER=${ccache_symlinks_path}")
cmake_launcher_defines+=("-DCMAKE_CXX_COMPILER_LAUNCHER=${ccache_symlinks_path}")
else
@@ -155,8 +156,6 @@ jobs:
if command -v ccache &> /dev/null; then
echo "📊 ccache statistics (post-build):"
ccache --show-stats || true
- echo "🎯 ccache hit ratio summary:"
- ccache --show-stats | grep -E "(cache hit|cache miss|files compiled)" || true
fi
- name: Check documented compiler versions