Skip to content

reduce what e2e workflows store in the actions cache - #19357

Merged
kevinushey merged 7 commits into
mainfrom
test/e2e-actions-cache-hygiene
Nov 2, 2026
Merged

kevinushey merged 7 commits into
mainfrom
test/e2e-actions-cache-hygiene

Conversation

@kevinushey

@kevinushey kevinushey commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

The repo's Actions cache sits at its 10 GB quota and evicts constantly. On 2026-10-29 its least recently used entry had last been read about a day earlier. Three things written to it are never, or almost never, read back.

Changes

  • The rotation and certification workflows no longer save the os-e2e-deps caches (R library, pak downloads, Playwright browsers), through a new save-cache action input. The engine workflows expose it as the workflow_call input skip_e2e_deps_cache_save, defaulting to false. Rotation engines run once or twice a week, so their entries (~0.55 GB per engine) were evicted before anything read them. The Sunday runs write roughly 12 GB, which flushes main's build caches. For the last seven Sundays the sentinel has re-dispatched the macOS 26, Ubuntu 24, and Windows seeds every Sunday afternoon. The four daily platforms stay warm from os-cache-seed-e2e-deps.yml and their nightly scheduled runs, which are unchanged.

  • The cache-seed sentinel prunes superseded GWT output on main, keeping the two newest entries per key. GWT output is keyed on a hash of the GWT sources and is only reused on an exact key match, since a restore-keys match recompiles from scratch. Older entries are dead weight: the Windows key alone had 7 versions on main. A dry run against the live cache keeps 2 of each of the 5 keys and would delete 9 entries.

  • The Ubuntu 24 Server workflow now uses the Linux Desktop engine's noble-amd64 os-e2e-deps scope. Both run on ubuntu-24.04 with the same R version and package set, and they were saving byte-identical keys apart from the prefix (~0.5 GB duplicated). The deps seed and the sentinel drop the old unscoped Linux- entries.

  • The Windows builds trim their tools cache before saving it, cutting ~1 GB of the 2.1 GB entry. The Windows Server 2025 and Windows 11 arm64 workflows save the same key from identical build jobs, so both run the trim from one composite action, os-trim-windows-tools:

    • rstudio-tools.cmd's :install keeps every archive after extracting it, but skips any dependency whose folder exists, so those archives are never read again (~630 MB). The exception is copilot: install-dependencies.cmd deletes and re-extracts it on every run, so the zip for the version it pins stays and the extracted copy goes instead (~340 MB). Superseded copilot zips go too, so a copilot bump doesn't carry the old ~350 MB zip into every later entry.
    • A RelWithDebInfo build without MULTIARCH links only the release x64 OpenSSL, so the debug and 32-bit variants are dropped (~75 MB).
    • All four Boost variants stay: install-soci.R builds SOCI against every one of them whenever SOCI is rebuilt, and the Boost marker folder would suppress a reinstall.
    • The key moves to v3 in both workflows so the trimmed entry replaces the current one. v2 stays as a fallback restore key, so the first save starts from the existing entry rather than a cold install.
    • The step runs with continue-on-error, so a failed trim only means a larger entry.
  • Cache saves compress with ZSTD_CLEVEL: 9, set once in a workflow-level env: in each of the 8 engine workflows, which covers every save in every job, composite steps included. The os-e2e-deps action also sets it per step for its callers outside the engines (the deps seed and the autocomplete workflow). actions/cache compresses with zstd but passes no level, so zstd uses its default of 3 and honors ZSTD_CLEVEL (checked in actions/toolkit's tar.ts). On a 1.6 GB tools tree (Boost plus Quarto), level 9 gave 261 MB against 299 MB at level 3, with save time nearly unchanged (36 s vs 33 s, mostly tar I/O). Level 15 saved only another 3% and took 42 minutes. Decompression speed doesn't depend on the level, so restores are unaffected. In the engine workflows, setup-node's npm cache saves (27-48 MB each) also pick up level 9. Nothing else in those jobs runs the zstd CLI: CPack and rpmbuild link libzstd, which doesn't read ZSTD_CLEVEL.

Engine workflows dispatched directly still save: !inputs.skip_e2e_deps_cache_save is true when the input is absent.

Verification

  • actionlint over every os-test-e2e-rstudio-* and os-cache-seed-* workflow reports the same 21 findings as origin/main, with none introduced.
  • The prune step's listing and filter, run locally against the live cache (listing only), selected the oldest entries as expected.
  • ZSTD_CLEVEL=9 zstd -T0 produces byte-identical output to zstd -T0 -9 (Homebrew zstd).
  • The trim step's script, run in PowerShell in a container against a mock tools tree, removed the top-level archives except copilot's, the extracted copilot directory, and three OpenSSL variants. Nested archives, Boost, SOCI, and the install-check folders were left in place. Re-run from the composite action with copilot 1.551.2 and 1.555.7 zips present, it removed 1.551.2 and kept 1.555.7, the version pinned in a CRLF copy of install-dependencies.cmd. With the pin removed, it failed before deleting anything.

After merge, check that:

  • The next sentinel run logs "Pruned N of M GWT caches".
  • The next rotation run saves no Linux-<distro>-{r,pak,pw}- entries.
  • The Sunday re-seed dispatches stop.
  • The Windows seed logs "Trimmed N MB from rstudio-tools", and a rstudio-tools-win64-v3- entry of under ~1 GB appears.
  • Newly saved entries are smaller than their predecessors under unchanged keys. The Cache Size line in the save step's log shows the size.

Addresses #19355.

- The rotation and certification workflows no longer save os-e2e-deps caches. Their engines run once or twice a week, so the entries were evicted before they were read again, and the Sunday runs (~12 GB) flushed main's build caches every week.
- The cache-seed sentinel prunes superseded GWT output caches on main, keeping the two newest per key.
- The Ubuntu 24 Server workflow shares the Linux Desktop engine's noble-amd64 os-e2e-deps keys instead of saving a duplicate unscoped set.

Addresses #19355.
@kevinushey kevinushey added this to the 2026.11 (Montauk Daisy) milestone Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
4669 0 230 0
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
✅ desktop-linux 1168 0 43 0
✅ desktop-macos 1174 0 38 0
✅ desktop-windows 1167 0 50 0
✅ server-linux 1108 0 51 0
✅ setup 48 0 32 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit 5d86ad160021cda85fcff1951c11163f11bfd494 - Run #1842

Drop the archives rstudio-tools.cmd keeps after extracting (all but copilot's, which is re-extracted every run), the extracted copilot directory, and the OpenSSL variants a RelWithDebInfo x64 build never links: ~1 GB of the ~2.1 GB entry. Boost variants stay, since a SOCI rebuild needs all four. The key moves to v3 so the trimmed entry replaces the current one, with v2 as a fallback restore key to avoid a cold install.

Addresses #19355.
@kevinushey kevinushey changed the title keep rotation runs and stale gwt builds out of the actions cache reduce what e2e workflows store in the actions cache Oct 29, 2026
actions/cache passes zstd no level, so it uses the default of 3. ZSTD_CLEVEL=9 on each save step makes entries ~13% smaller (measured on a tools tree: 299 MB -> 261 MB) at about the same save time; decompression speed is unaffected.

Addresses #19355.
@kevinushey
kevinushey requested a review from gtritchie October 30, 2026 01:35

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two issues with the Windows tools cache change, plus three smaller ones inline.

  1. The trim keeps every copilot zip version, so the entry grows back by ~353 MB per copilot bump.
  2. The Windows 11 arm64 workflow shared this rstudio-tools-win64-v2- key and is left behind on it, so its main dispatches go cold.


$remove = @(
Get-ChildItem -LiteralPath "$deps\common", "$deps\windows" -File |
Where-Object { $_.Name -match '\.(zip|7z|tar\.gz)$' -and $_.Name -notlike 'copilot-language-server-js-*' }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

-notlike 'copilot-language-server-js-*' exempts every copilot zip, not just the current version's. COPILOT_VERSION lives in install-dependencies.cmd, which is in the key's hashFiles, so a bump misses the key and restores the previous v3 entry through the rstudio-tools-win64-v3- restore key. install-dependencies.cmd removes the extracted copilot-language-server-js directory but never the old zip, so the trim keeps both and the new entry carries the dead one.

The 1.555.7 zip is 353,354,496 bytes, and install-dependencies.cmd has had 8 copilot bumps since May, so about three bumps undo the ~1 GB this step saves. Exempting only copilot-language-server-js-<COPILOT_VERSION>.zip (reading the version from install-dependencies.cmd) would keep the entry trimmed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in e2610fe. The trim now reads COPILOT_VERSION from install-dependencies.cmd and keeps only copilot-language-server-js-<version>.zip. If it can't find the pin, the step fails before deleting anything (continue-on-error, so the entry is just untrimmed). Against a mock tree with both the 1.551.2 and 1.555.7 zips, it removed 1.551.2 and kept 1.555.7.

with:
path: ${{ env.RSTUDIO_TOOLS_ROOT }}
key: rstudio-tools-win64-v2-${{ hashFiles('dependencies/common/install-*', 'dependencies/common/rig.cmake', 'dependencies/windows/install-*.cmd', 'dependencies/windows/install-soci/**', 'dependencies/windows/tools.R', 'dependencies/tools/rstudio-tools.cmd') }}
key: rstudio-tools-win64-v3-${{ hashFiles('dependencies/common/install-*', 'dependencies/common/rig.cmake', 'dependencies/windows/install-*.cmd', 'dependencies/windows/install-soci/**', 'dependencies/windows/tools.R', 'dependencies/tools/rstudio-tools.cmd') }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

os-test-e2e-rstudio-desktop-os-windows-11-arm64.yml:260 uses the same rstudio-tools-win64-v2- key with the same hashFiles, runs its build job on windows-2025, and has the same RSTUDIO_TOOLS_ROOT, so today it restores this workflow's entry. After this change nothing refreshes v2, and GitHub removes it 7 days after its last access.

That workflow is dispatched on main about monthly (2026-08-31, 09-10, 10-09). Each dispatch would then miss both its key and its restore key, install every dependency cold, and save a new untrimmed ~2.1 GB v2 entry. Moving it to v3 with the same trim step, or at least adding a rstudio-tools-win64-v3- restore key, keeps it warm.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in e2610fe. The arm64 workflow moves to v3 with the same v3/v2 restore keys, and both workflows now run the trim from .github/actions/os-trim-windows-tools, so whichever one saves the shared key saves the same tree.

One correction: the three main dispatches (08-31, 09-10, 10-09) all tested the daily installer with build skipped, so they never touched this cache. The exposure is a build-from-source dispatch (the input's default), which would have gone cold once v2 aged out and, on main, saved a fresh untrimmed v2 entry.

# Same scope as the Linux Desktop workflow's Ubuntu 24 engine
# (.github/e2e-linux/ubuntu-24-x86_64.json): same runner image, R
# version, and package set, so the two share one set of caches.
cache-scope: noble-amd64

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This copies e2e_deps_cache_scope from .github/e2e-linux/ubuntu-24-x86_64.json. .github/e2e-linux/README.md documents which ubuntu-24-x86_64 keys are shared with Linux Server (lines 34-36, 144-147, 197) but not that this scope now is. Someone changing the Desktop scope would have no pointer here, and the two would silently stop sharing. A README note next to the existing tools/rlibs sharing notes would cover it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added in 3c1b2bc, next to the tools/rlibs sharing note and in the config-keys table row for e2e_deps_cache_scope.

# ZSTD_CLEVEL; level 9 makes entries ~13% smaller than the default
# level 3 at about the same save time, and restores are unaffected.
env:
ZSTD_CLEVEL: 9

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ZSTD_CLEVEL: 9 is set on 27 separate save steps, with this comment in 9 files. A single job- or workflow-level env: per engine would cover every save, including the composite action's steps, which inherit job env. Decompression ignores the level, so restores are unaffected, and a save step added later can't miss it. The action can keep its per-step env for callers outside the engines (the deps seed and the autocomplete workflow).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in ef2bda5: one workflow-level env: per engine workflow. The action keeps its per-step env for the deps seed and the autocomplete workflow. Nothing else in those jobs runs the zstd CLI (CPack/rpmbuild link libzstd, which doesn't read ZSTD_CLEVEL). The only side effect is that setup-node's npm cache saves also compress at level 9 now, which is negligible at 27-48 MB.

if: ${{ !cancelled() }}
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

GH_REPO isn't used in this step: the only gh calls are gh api with an explicit repos/$GITHUB_REPOSITORY/... path. It looks copied from the check step above, which needs it for gh workflow run and gh issue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Dropped in 5d86ad1.

A workflow-level env covers every save step in every job, including os-e2e-deps' composite steps, so a save added later can't miss it. The action keeps its per-step env for callers outside the engines (the deps seed and the autocomplete workflow). setup-node's npm cache saves now also compress at level 9.

Addresses #19355.
The Windows 11 arm64 workflow's build job saves the same rstudio-tools-win64 key as Windows Server 2025's, so it moves to v3 too (with the v2 fallback) and both run the trim from one composite action. Left on v2, its build-from-source dispatches would go cold once v2 aged out, and a main dispatch would save a fresh untrimmed v2 entry.

The trim now keeps only the copilot archive pinned in install-dependencies.cmd rather than every copilot zip. A copilot bump restores the previous entry through the restore key, and the superseded ~350 MB archive would otherwise carry into every later entry.

Addresses #19355.
@kevinushey
kevinushey merged commit 9988a39 into main Nov 2, 2026
55 checks passed
@kevinushey
kevinushey deleted the test/e2e-actions-cache-hygiene branch November 2, 2026 01:21
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