Skip to content

zephyr-cp CI: disable action-zephyr-setup's ccache - #11421

Open
dhalbert wants to merge 1 commit into
adafruit:mainfrom
dhalbert:zephyr-ci-disable-ccache
Open

dhalbert wants to merge 1 commit into
adafruit:mainfrom
dhalbert:zephyr-ci-disable-ccache

Conversation

@dhalbert

Copy link
Copy Markdown
Collaborator

Claude found and measured this, reviewed by @dhalbert.

This PR removes the use of ccache, because it was ineffective. It wasn't expensive to run, but it wasn't helping, either.

What ccache was doing

action-zephyr-setup enables ccache by default. Its cache key is ccache-default-<timestamp> with the restore prefix ccache-default-, so every zephyr-cp board job restores whichever entry any board saved most recently, adds its own objects, and saves a new ~150 MB entry. The surviving cache is a collection of whichever boards happened to save last; which boards it helps is luck.

Measurement

#11417, a throw-away PR, measured what was going on by adding a ccache -s -v step after the build. It ran all 30 boards (run 35396278862). Every job restored the same 140 MB entry.

Boards ccache hit rate
nxp_frdm_rw612, nxp_mimxrt1170_evk, native_native_sim_asan, native_nrf5340bsim, native_nrf54lm20bsim 99.7-100 %
the other 25 0-1.2 %, one hit each

Against the previous run on main with the same code, the five boards with full hits changed by -8 s on average and the 25 boards without full hits by -17 s; runner noise is ±50 s. ccache covers only the ~394 Zephyr objects, which ninja compiles in under a minute on the 4-core runner, and cpbuild calls the compiler directly so the CircuitPython objects never go through it. Restoring and saving the entry costs about 10 s per job.

Meanwhile the entries fill the repository's Actions cache: 49 new ccache entries were added in three hours of runs, 7.5 GB. The pool is at its 10 GB cap, so every run evicts older entries. The Zephyr SDK (0.5 GB), the espressif tools (1.2 GB) and the submodule caches share that pool.

A per-board key would give every board full hits, but the measurement above says full hits buy no time, and it would still add 30 entries per run.

Change

Set enable-ccache: false on the action-zephyr-setup step.

Cleanup

Existing ccache-default-* entries expire after a week unused, or can be removed now with gh cache delete.

Every zephyr-cp board job saved a new ~150 MB ccache entry under a key shared by all boards, and restored whichever entry was saved last. Measured over all 30 boards in one run: 5 boards hit by luck, 25 had one hit each, and the hit boards built no faster. The entries were filling the repository's 10 GB Actions cache and evicting the Zephyr SDK and other ports' caches.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@dhalbert
dhalbert requested a review from tannewt September 19, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant