Skip to content

Commit 3118848

Browse files
committed
increment branch cache key
1 parent a8fdeea commit 3118848

File tree

4 files changed

+73
-7
lines changed

4 files changed

+73
-7
lines changed

.github/workflows/ci-linux.yml

+24-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ jobs:
3535
fail-fast: true
3636
env:
3737
CACHE_DIR: ${{ github.workspace }}/.container-cache
38-
CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || github.ref_name }}
38+
# either the PR number or `branch-N` where N always increments
39+
CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }}
3940
steps:
4041
- name: Set unified TZ
4142
uses: szenius/[email protected]
@@ -79,6 +80,15 @@ jobs:
7980
key: ${{ env.CACHE_KEY }}
8081
restore-keys: linux-build-test-cpp-
8182

83+
- name: Configure ccache debug logs
84+
run: |
85+
# https://interrupt.memfault.com/blog/ccache-debugging
86+
echo CCACHE_DEBUG=1 >> $GITHUB_ENV
87+
echo CCACHE_DEBUGLEVEL=2 >> $GITHUB_ENV
88+
echo CCACHE_DEBUGDIR="/ccache-debug" >> $GITHUB_ENV
89+
echo CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros >> $GITHUB_ENV
90+
echo CCACHE_COMPILERCHECK=content >> $GITHUB_ENV
91+
8292
- name: Build packages
8393
run: |
8494
export cache_dir="${{ env.CACHE_DIR }}"
@@ -89,6 +99,19 @@ jobs:
8999
run: |
90100
tar cf iree-dist-linux.tar -C iree-install .
91101
102+
- name: Tar ccache logs
103+
if: ${{ !cancelled() }}
104+
run: |
105+
tar cf linux-ccache-logs.tar $CCACHE_DEBUGDIR
106+
107+
- name: Upload ccache logs
108+
uses: actions/upload-artifact@v4
109+
if: ${{ !cancelled() }}
110+
with:
111+
name: ccache_logs
112+
path: linux-ccache-logs.tar
113+
if-no-files-found: warn
114+
92115
- name: Upload artifacts
93116
uses: actions/upload-artifact@v4
94117
if: ${{ !cancelled() }}

.github/workflows/ci-macos.yml

+24-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: [macos-12, macos-14]
3131
env:
3232
CACHE_DIR: ${{ github.workspace }}/.container-cache
33-
CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }}
33+
CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }}
3434
steps:
3535
- name: Set unified TZ
3636
uses: szenius/[email protected]
@@ -68,6 +68,15 @@ jobs:
6868
key: ${{ env.CACHE_KEY }}
6969
restore-keys: ${{ matrix.runs-on }}-build-test-cpp-
7070

71+
- name: Configure ccache debug logs
72+
run: |
73+
# https://interrupt.memfault.com/blog/ccache-debugging
74+
echo CCACHE_DEBUG=1 >> $GITHUB_ENV
75+
echo CCACHE_DEBUGLEVEL=2 >> $GITHUB_ENV
76+
echo CCACHE_DEBUGDIR="/ccache-debug" >> $GITHUB_ENV
77+
echo CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros >> $GITHUB_ENV
78+
echo CCACHE_COMPILERCHECK=content >> $GITHUB_ENV
79+
7180
- name: Build packages
7281
run: |
7382
export cache_dir="${{ env.CACHE_DIR }}"
@@ -76,9 +85,20 @@ jobs:
7685
- name: Create artifacts
7786
if: ${{ !cancelled() }}
7887
run: |
79-
rm -f iree-install/bin/clang*
80-
rm -f iree-install/bin/llvm-link*
81-
tar cf iree-dist-${{ matrix.runs-on }}.tar -C iree-install . -C ../iree-build tools/testing/e2e/iree-e2e-matmul-test
88+
tar cf iree-dist-${{ matrix.runs-on }}.tar -C iree-install .
89+
90+
- name: Tar ccache logs
91+
if: ${{ !cancelled() }}
92+
run: |
93+
tar cf macos-ccache-logs.tar $CCACHE_DEBUGDIR
94+
95+
- name: Upload ccache logs
96+
uses: actions/upload-artifact@v4
97+
if: ${{ !cancelled() }}
98+
with:
99+
name: ccache_logs
100+
path: macos-ccache-logs.tar
101+
if-no-files-found: warn
82102

83103
- name: Upload artifacts
84104
uses: actions/upload-artifact@v4

.github/workflows/ci-windows.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
fail-fast: true
3434
env:
3535
CACHE_DIR: ${{ github.workspace }}/.container-cache
36-
CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }}
36+
CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }}
3737
steps:
3838
- name: Set unified TZ
3939
uses: szenius/[email protected]
@@ -76,6 +76,15 @@ jobs:
7676
key: ${{ env.CACHE_KEY }}
7777
restore-keys: windows-build-test-cpp-
7878

79+
- name: Configure ccache debug logs
80+
run: |
81+
# https://interrupt.memfault.com/blog/ccache-debugging
82+
echo CCACHE_DEBUG=1 >> $GITHUB_ENV
83+
echo CCACHE_DEBUGLEVEL=2 >> $GITHUB_ENV
84+
echo CCACHE_DEBUGDIR="/ccache-debug" >> $GITHUB_ENV
85+
echo CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros >> $GITHUB_ENV
86+
echo CCACHE_COMPILERCHECK=content >> $GITHUB_ENV
87+
7988
- name: Build packages
8089
run: |
8190
export cache_dir="${{ env.CACHE_DIR }}"
@@ -86,6 +95,19 @@ jobs:
8695
run: |
8796
tar cf iree-dist-windows.tar -C iree-install .
8897
98+
- name: Tar ccache logs
99+
if: ${{ !cancelled() }}
100+
run: |
101+
tar cf windows-ccache-logs.tar $CCACHE_DEBUGDIR
102+
103+
- name: Upload ccache logs
104+
uses: actions/upload-artifact@v4
105+
if: ${{ !cancelled() }}
106+
with:
107+
name: ccache_logs
108+
path: windows-ccache-logs.tar
109+
if-no-files-found: warn
110+
89111
- name: Upload artifacts
90112
uses: actions/upload-artifact@v4
91113
if: ${{ !cancelled() }}

build_tools/ci/build_test_cpp.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ elif [[ "$OSTYPE" == "msys"* ]]; then
116116
fi
117117

118118
# Show ccache stats.
119-
ccache --show-stats
119+
ccache --show-stats -v
120+
grep -r -B15 'Result: .*_miss' $CCACHE_DEBUGDIR
120121

121122
rm -f "$install_dir"/bin/clang*
122123
rm -f "$install_dir"/bin/llvm-link*

0 commit comments

Comments
 (0)