Skip to content

Commit 0584df3

Browse files
authored
Prune ccache caches in CI on each run (#457)
I noticed in a [recent build] that the cache size for Windows is quite large at 500M. That might be related to switching to MSVC, I'm not sure, but something else I've realized is that as-configured wasi-sdk will continuously grow the cache over time and it won't ever get trimmed until we hit github actions limits. This is because the cache is restored from an older version, then appended to with the current build, then saved again. That theoretically means that each builder could make up to a 5G cache which is a bit too large. This commit adds an extra step that removes all objects older than 1d to ensure that older builds eventually get cleaned out of the cache. GitHub Actions should then still delete older caches pretty regularly but each individual cache should be bounded still. [recent build]: https://github.com/WebAssembly/wasi-sdk/actions/runs/10045872592/job/27764084758?pr=456
1 parent 9af8b0f commit 0584df3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ jobs:
152152
name: ${{ format( 'dist-{0}', matrix.artifact) }}
153153
path: build/dist
154154

155+
# Caches are persisted across runs by restoring the latest cache which
156+
# means that quite a lot of cruft can accumulate. Prune older entries that
157+
# haven't been used by this run to avoid the cache continuously getting
158+
# larger. In theory this should use `--evict-older-than $dur` where `$dur`
159+
# is the time since the start of the run, but I'm not sure how to easily
160+
# calculate that so pick something loose like one day instead.
161+
- name: Prune ccache objects
162+
run: ccache --evict-older-than 1d
163+
155164
# Help debug ccache issues by showing what happened.
156165
- if: always()
157166
name: Show ccache statistics

0 commit comments

Comments
 (0)