Commit 5e46e52
ENH: Optimize GitHub Actions ccache strategy for faster C++ builds
Key changes from upstream:
1. Remove CCACHE_NODIRECT=1: Enables direct mode so ccache skips the
preprocessor for cache lookups, significantly faster on hits.
2. Add CCACHE_SLOPPINESS=pch_defines,time_macros: Avoids cache misses
caused by __DATE__/__TIME__ macros that change every build. Standard
CI-safe setting.
3. CCACHE_MAXSIZE 2.4G -> 5G: ITK has ~4000 translation units; a
larger cache retains more objects across incremental builds.
4. SHA-based cache key with restore-keys fallback:
- key: ccache-v4-<os>-<config>-<sha> (unique per commit)
- restore-keys: ccache-v4-<os>-<config>- (most recent match)
Each build creates a new cache entry; restore-keys always finds
the most recent cache for the same OS and configuration.
Replaces the old static key that could never be updated once written.
5. Save on !cancelled() instead of main-only: PR builds now persist
their cache for subsequent pushes, but cancelled runs do not save
potentially incomplete caches.
6. Use runner.os (Linux/macOS/Windows) instead of matrix.os
(ubuntu-24.04-arm/macos-15) for cache key consistency across
runner image updates.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1e27859 commit 5e46e52
2 files changed
Lines changed: 14 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
177 | | - | |
| 179 | + | |
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
153 | | - | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | | - | |
| 159 | + | |
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| |||
0 commit comments