Skip to content

ci(release): share one small toolchain cache, stop refetching libraries - #59

Merged
Elektr0Vodka merged 1 commit into
mainfrom
fix/main-release-cache
Dec 1, 2026
Merged

Elektr0Vodka merged 1 commit into
mainfrom
fix/main-release-cache

Conversation

@Elektr0Vodka

Copy link
Copy Markdown

Reworks the caches of the DMC Firmware Release workflow so runs share one small set of toolchains and stop refetching what they already have. One file changed.

Why

Measured from the logs of the 23 release runs so far:

Toolchain cache restores 1.83 TB, about 1.06 GB each
Library cache exact hits 17 of 1,711 board jobs
Library git clones 2,338
Tool downloads in warm-up and board jobs 264

The keys hashed every variant file, so each branch saved its own copy of about 5 GB of identical toolchains. Three branches exceed the 10 GB limit, so they evicted each other's caches and the libraries. Each copy also held the download archives of tools that were already unpacked in it.

#55 (batching) lowers the number of restores but not this: its library cache would have overflowed the same way.

What changes

  • Toolchains (pio-tc-v2): keyed on platform, packages and the distinct board requirements of the whole project. Five caches serve all eight firmware sets and all three branches. Download archives are left out.
  • Warm-up: installs one env per distinct requirement instead of every env of the set. On a hit it only looks the cache up, without a checkout.
  • Libraries (pio-dl-v2): the .pio/libdeps cache is replaced by the library archives plus git mirrors of one batch, keyed by content and week. Anything over 20 MB is kept out.
  • Correctness: libraries are unpacked for every build. The old cache could restore a stale in-repo AsyncElegantOTA (it differs between dmc-dev and dmc-observer-dev) through its restore-keys.

Testing

  • Plan step run against the three branches' real configs: all boards covered, at most 12 per batch. A build_flags edit changes no key, a platform bump changes exactly one toolchain key, a new library changes at most one library key.
  • PlatformIO with Heltec V3: installed tools and an empty cache folder need no tool install; with only the saved archives (6 MB) the second library install downloads nothing (31 the first time).
  • Git libraries install from the mirrors with git over https blocked; an unreachable repository falls back without failing the step.
  • The reduced warm-up covers every env's tools on 4 of 5 platforms, checked with PlatformIO's own resolver.

Not tested:

  • No run on GitHub yet. Suggested first run: companion-observer on dev (5 boards; replaces that dev release).
  • RP2040 tool coverage (5 boards): its platform does not clone on Windows. A tool missing from the cache is downloaded by the build.
  • The size of the new toolchain caches. Roughly half is expected; the warm-up prints the uncompressed size.

Notes for review

  • GitHub deletes caches after 7 days without use, so the first run of a release session still downloads the toolchains once.
  • nordicnrf52 is not pinned in platformio.ini, so its version stays as cached until that cache is evicted or its key changes.
  • actionlint 1.7.7 reports queue (from ci: own-repository workflows only, batched release builds #55) as unknown; it is a documented GitHub setting newer than that release.
  • Whether cache traffic caused Actions to be switched off for this repository is not confirmed.

Measured over the 23 release runs so far: 1.83 TB of toolchain restores
(about 1.06 GB each), 264 tool downloads, 2,338 library clones, and a
library cache that hit exactly in 17 of 1,711 board jobs. The keys hashed
every variant file, so each branch saved its own ~5 GB of identical
toolchains and the 10 GB limit evicted them, and the libraries, again.

- Toolchain key: platform, packages and the distinct board requirements of
  the whole project. Five caches serve every firmware set and all branches.
- Leave the download archives out of it; the tools are already unpacked.
- The warm-up installs one env per distinct requirement instead of every
  env of the set, and does not even check the repository out on a hit.
- Replace the .pio/libdeps cache (tens of MB per board) by the library
  archives and git mirrors, a few MB per batch, refreshed weekly. Libraries
  are unpacked for every build, so an in-repo library such as
  AsyncElegantOTA can no longer come from another commit's cache.
@Elektr0Vodka
Elektr0Vodka merged commit b283c8a into main Dec 1, 2026
1 check passed
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