Skip to content

Keep downloaded Ubuntu packages in the CI cache - #11667

Merged
dhalbert merged 2 commits into
adafruit:mainfrom
mikeysklar:ci-cache-apt-packages
Oct 24, 2026
Merged

dhalbert merged 2 commits into
adafruit:mainfrom
mikeysklar:ci-cache-apt-packages

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

What

Keep the compiler and Zephyr packages in the Actions cache, so CI skips most downloads.

Why

Since Oct 22 a slow Ubuntu mirror has stalled CI jobs for 20 to 56 minutes.

This includes the commit from #11665 (mingw), so review only the second commit.

Packages Size Used by
SDL2 (32-bit) 138 MB native_sim builds and tests
mingw 65.2 MB mpy-cross for Windows
Zephyr deps, plus what action-zephyr-setup installs 32.7 MB every Zephyr job
aarch64 45.2 MB mpy-cross for aarch64
Cache
Saved Only on pushes to main
Key Hash of the .deb file names
Total size about 280 MB, of the 10 GB limit
action-zephyr-setup apt step Nothing left to download, checked in this PR's CI

Cache hits only start after this merges, since only pushes save.

Related PR Change
#11664 Board builds no longer wait for mpy-cross
#11665 mpy-cross downloads less
This PR Cache the downloads
#11666 Zephyr tests in more jobs

Written with Claude Code. I checked the Zephyr action's apt list and the job ordering.

🤖 Generated with Claude Code

Add a small action that keeps the downloaded .deb files in the Actions
cache, so slow Ubuntu mirror days don't stall builds. It is used for the
aarch64 and mingw toolchains, the Zephyr port deps, and the 32-bit SDL2
packages for native_sim. The Zephyr deps list also includes the packages
action-zephyr-setup installs, so its own apt-get has nothing to download.

The cache key is a hash of the .deb file names, so a package update makes
a new entry. Only pushes save, like the other dependency caches, and
autoclean keeps out versions the mirror no longer has.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dhalbert
dhalbert previously approved these changes Oct 24, 2026

@dhalbert dhalbert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - kind of crazy we have to do this, because the point of the mirror is to be a "local" cache for GitHub CI.

Was this invented out of whole cloth, or is there precedent of this in other repos?

@mikeysklar
mikeysklar dismissed dhalbert’s stale review October 24, 2026 12:52

The merge-base changed after approval.

dhalbert
dhalbert previously approved these changes Oct 24, 2026
@mikeysklar
mikeysklar dismissed dhalbert’s stale review October 24, 2026 13:05

The merge-base changed after approval.

dhalbert
dhalbert previously approved these changes Oct 24, 2026
@dhalbert
dhalbert enabled auto-merge October 24, 2026 13:06
@dhalbert
dhalbert merged commit 9774ee6 into adafruit:main Oct 24, 2026
13 checks passed
@mikeysklar

mikeysklar commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Dan -

81% of Friday's (10/23/26) large-PR build time was waiting on slow Ubuntu downloads. The worst build took 130min to do 13min of work.

There's precedent for caching Ubuntu images and apt downloads. It comes from the slow mirror problem. As long as a mirror responds another one will NOT be selected. Even if the mirror that responded is unusably slow.

@dhalbert

Copy link
Copy Markdown
Collaborator

Thanks. https://github.com/awalsh128/cache-apt-pkgs-action looks interesting but v2 is in process, so rolling our own seems better for now.

@mikeysklar

Copy link
Copy Markdown
Collaborator Author

This simple cache should be good for now. I expect regular main build time to be less than 15 min typically with the runners and the PRs we have add this week.

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.

2 participants