diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index f6c269978..56093a067 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -35,7 +35,8 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || github.ref_name }} + # either the PR number or `branch-N` where N always increments + CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index a94d84b69..a86d11c56 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -30,7 +30,7 @@ jobs: runs-on: [macos-12, macos-14] env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }} + CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 07e5e3248..d4e3c3899 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -33,7 +33,7 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }} + CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 diff --git a/build_tools/ci/build_test_cpp.sh b/build_tools/ci/build_test_cpp.sh index 65c61332a..ea1929cde 100644 --- a/build_tools/ci/build_test_cpp.sh +++ b/build_tools/ci/build_test_cpp.sh @@ -40,6 +40,16 @@ export CCACHE_DIR="${cache_dir}/ccache" export CCACHE_MAXSIZE="700M" export CMAKE_C_COMPILER_LAUNCHER=ccache export CMAKE_CXX_COMPILER_LAUNCHER=ccache +# https://interrupt.memfault.com/blog/ccache-debugging +export CCACHE_DEBUG=1 +export CCACHE_DEBUGLEVEL=1 +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + export CCACHE_DEBUGDIR="/ccache-debug" +elif [[ "$OSTYPE" == "msys"* ]]; then + export CCACHE_DEBUGDIR="/c/ccache-debug" +fi +export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime +export CCACHE_COMPILERCHECK=content # Clear ccache stats. ccache -z @@ -116,7 +126,8 @@ elif [[ "$OSTYPE" == "msys"* ]]; then fi # Show ccache stats. -ccache --show-stats +ccache --show-stats -v +grep -r -B15 'Result: .*_miss' $CCACHE_DEBUGDIR rm -f "$install_dir"/bin/clang* rm -f "$install_dir"/bin/llvm-link*