Key the apt cache per PHP version and drop the instrumentation
CI / No Debug Code (pull_request) Successful in 26s
CI / Tests (PHP 8.1) (pull_request) Successful in 2m35s
CI / Tests (PHP 8.2) (pull_request) Successful in 2m35s
CI / Coding Standards & Static Analysis (pull_request) Successful in 4m1s
CI / Tests (PHP 8.3) (pull_request) Failing after 7m17s
CI / Build Plugin Zip (pull_request) Skipped

Run 536 proved the cache works -- ACTIONS_CACHE_URL is now populated, no
GHES warning, "Cache saved with key: apt-php-builder-deps-ARM64-v1" -- and
in doing so showed the key was wrong. The jobs that saved it were 8.1 and
8.2.

They take the ondrej PPA path, a handful of runtime packages, while 8.3
takes php-builder and its ~70 -dev packages. One shared key therefore lets
whichever job finishes first decide what every other job restores, and 8.1
is always first, at ~30s against 8.3's several minutes. 8.3 would have
restored a few runtime .debs it has no use for and then downloaded all 70
anyway. My "the dep list is the same for every PHP version" comment was
true only among the builder versions.

Keyed per version now, so each path caches what it actually installs. That
also picks up a small win on 8.1 and 8.2 rather than only avoiding harm.

Both temporary steps are gone. Report restored .debs was there to show the
cache URL arriving and the restore landing; both are established, so it
goes. Keep downloaded .debs stays -- it is not instrumentation, it disables
Ubuntu's docker-clean, without which there are no .debs left to cache.

Refs #178.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Uw545F1vveNJKjzLxdi2ks
This commit is contained in:
2026-08-20 15:57:27 -03:00
co-authored by Claude Opus 5
parent d5f6ebf0b5
commit a90e06ae70
+42 -51
View File
@@ -20,14 +20,20 @@ jobs:
- uses: actions/checkout@v4
# setup-php installs PHP 8.3+ through php-builder, which apt-installs ~70
# -dev packages before unpacking the build (#178). Ubuntu's own image
# deletes the .debs after install, so every job re-downloads them from
# the archive. Keep them and restore them from the cache server, which
# lives in the cluster, turning a WAN download into a local one.
# -dev packages before unpacking the build (#178). Ubuntu's image deletes
# the .debs after install, so every job re-downloads them. Keeping them
# and restoring them from the cache server, which lives in the cluster,
# turns a WAN download into a local one.
#
# The dep list is the same for every PHP version on the builder path, so
# one shared key serves them all. Only the .debs are cached, never
# /var/lib/apt/lists — a stale index is how you get 404s on install.
# Keyed per PHP version because the install path differs by version and
# the package sets are not interchangeable: 8.3+ pulls the ~70 -dev
# packages through php-builder, while 8.1 and 8.2 come from the ondrej
# PPA as a handful of runtime packages. Sharing one key across both lets
# whichever job finishes first decide what the others restore, and 8.1 is
# always first.
#
# Only the .debs are cached, never /var/lib/apt/lists — a stale index is
# how you get 404s mid-install.
- name: Keep downloaded .debs
run: |
sudo rm -f /etc/apt/apt.conf.d/docker-clean
@@ -38,16 +44,7 @@ jobs:
uses: actions/cache@v4
with:
path: /var/cache/apt/archives/*.deb
key: apt-php-builder-deps-${{ runner.arch }}-v1
# Temporary, for #178: shows whether the cache actually served the
# builder's dependencies, and times the step that consumes them.
- name: Report restored .debs
run: |
echo "ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL:-<unset>}"
echo "restored .debs: $(ls /var/cache/apt/archives/*.deb 2>/dev/null | wc -l)"
echo "restored size: $(du -sh /var/cache/apt/archives 2>/dev/null | cut -f1)"
date -u +'setup-php start: %H:%M:%S'
key: apt-php8.3-${{ runner.arch }}-v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -84,14 +81,20 @@ jobs:
- uses: actions/checkout@v4
# setup-php installs PHP 8.3+ through php-builder, which apt-installs ~70
# -dev packages before unpacking the build (#178). Ubuntu's own image
# deletes the .debs after install, so every job re-downloads them from
# the archive. Keep them and restore them from the cache server, which
# lives in the cluster, turning a WAN download into a local one.
# -dev packages before unpacking the build (#178). Ubuntu's image deletes
# the .debs after install, so every job re-downloads them. Keeping them
# and restoring them from the cache server, which lives in the cluster,
# turns a WAN download into a local one.
#
# The dep list is the same for every PHP version on the builder path, so
# one shared key serves them all. Only the .debs are cached, never
# /var/lib/apt/lists — a stale index is how you get 404s on install.
# Keyed per PHP version because the install path differs by version and
# the package sets are not interchangeable: 8.3+ pulls the ~70 -dev
# packages through php-builder, while 8.1 and 8.2 come from the ondrej
# PPA as a handful of runtime packages. Sharing one key across both lets
# whichever job finishes first decide what the others restore, and 8.1 is
# always first.
#
# Only the .debs are cached, never /var/lib/apt/lists — a stale index is
# how you get 404s mid-install.
- name: Keep downloaded .debs
run: |
sudo rm -f /etc/apt/apt.conf.d/docker-clean
@@ -102,16 +105,7 @@ jobs:
uses: actions/cache@v4
with:
path: /var/cache/apt/archives/*.deb
key: apt-php-builder-deps-${{ runner.arch }}-v1
# Temporary, for #178: shows whether the cache actually served the
# builder's dependencies, and times the step that consumes them.
- name: Report restored .debs
run: |
echo "ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL:-<unset>}"
echo "restored .debs: $(ls /var/cache/apt/archives/*.deb 2>/dev/null | wc -l)"
echo "restored size: $(du -sh /var/cache/apt/archives 2>/dev/null | cut -f1)"
date -u +'setup-php start: %H:%M:%S'
key: apt-php${{ matrix.php }}-${{ runner.arch }}-v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -157,14 +151,20 @@ jobs:
- uses: actions/checkout@v4
# setup-php installs PHP 8.3+ through php-builder, which apt-installs ~70
# -dev packages before unpacking the build (#178). Ubuntu's own image
# deletes the .debs after install, so every job re-downloads them from
# the archive. Keep them and restore them from the cache server, which
# lives in the cluster, turning a WAN download into a local one.
# -dev packages before unpacking the build (#178). Ubuntu's image deletes
# the .debs after install, so every job re-downloads them. Keeping them
# and restoring them from the cache server, which lives in the cluster,
# turns a WAN download into a local one.
#
# The dep list is the same for every PHP version on the builder path, so
# one shared key serves them all. Only the .debs are cached, never
# /var/lib/apt/lists — a stale index is how you get 404s on install.
# Keyed per PHP version because the install path differs by version and
# the package sets are not interchangeable: 8.3+ pulls the ~70 -dev
# packages through php-builder, while 8.1 and 8.2 come from the ondrej
# PPA as a handful of runtime packages. Sharing one key across both lets
# whichever job finishes first decide what the others restore, and 8.1 is
# always first.
#
# Only the .debs are cached, never /var/lib/apt/lists — a stale index is
# how you get 404s mid-install.
- name: Keep downloaded .debs
run: |
sudo rm -f /etc/apt/apt.conf.d/docker-clean
@@ -175,16 +175,7 @@ jobs:
uses: actions/cache@v4
with:
path: /var/cache/apt/archives/*.deb
key: apt-php-builder-deps-${{ runner.arch }}-v1
# Temporary, for #178: shows whether the cache actually served the
# builder's dependencies, and times the step that consumes them.
- name: Report restored .debs
run: |
echo "ACTIONS_CACHE_URL: ${ACTIONS_CACHE_URL:-<unset>}"
echo "restored .debs: $(ls /var/cache/apt/archives/*.deb 2>/dev/null | wc -l)"
echo "restored size: $(du -sh /var/cache/apt/archives 2>/dev/null | cut -f1)"
date -u +'setup-php start: %H:%M:%S'
key: apt-php8.3-${{ runner.arch }}-v1
- name: Setup PHP
uses: shivammathur/setup-php@v2