Repository navigation
feat(build-dependency-cache): share the S3 cache actions for sbt, mise and uv (SC-88184) - #20
Merged
Merged
Conversation
samidalouche
force-pushed
the
feat/sc-88184/build-dependency-cache
branch
2 times, most recently
from
November 24, 2026 17:27
d2770d1 to
1ac8626
Compare
samidalouche
force-pushed
the
feat/sc-88184/build-dependency-cache
branch
4 times, most recently
from
November 24, 2026 20:35
4add6bd to
5a8123b
Compare
…e and uv (SC-88184) narrative-marketplace-backend, narrative-connectors and narrative-snowflake-data-plane each carry an identical copy of the action that keeps sbt's dependency caches in S3 instead of GitHub's cache, which the runners reach through a NAT gateway that bills every byte (SC-87124). narrative-marketplace-backend#3556 replaces it with .github/actions/build-dependency-cache: an engine and one action per tool, adding mise's tools, the bulk of the NAT traffic left, and uv's packages, which nothing cached in narrative-marketplace-backend and GitHub's cache held in narrative-snowflake-data-plane. This puts that folder here, file for file, for the three repositories to pin; only the path its pyproject.toml extends ruff's rules from differs. - build-dependency-cache/s3_cache.py: the archive logic, with kinds sbt, mise and uv: folders, key files, S3 layout, latest, runner markers, saving only on a push to main, and stats in the log. - build-dependency-cache/cache-sbt and cache-uv: JavaScript actions only to get a post step, which saves when the job ends with every step passed, in the job that passes save: true. Their scripts start s3_cache.py through build-dependency-cache/s3-cache.js. - build-dependency-cache/setup-mise: a composite action around jdx/mise-action, with its cache off, that restores before it and prunes and saves right after it. It runs s3_cache.py itself: an action here can only reach a sibling with `uses: narrative-io/common-github/<path>@<commit>`, and a commit can't name itself. - All three require url, the base S3 URL, which callers pass from the organization variable COMMON_GITHUB_BUILD_DEPENDENCY_CACHE, so the bucket stays out of this public repository. An empty url fails the step, so a repository can't run without its cache unnoticed; trouble reaching S3 still only warns. Callers keep their kill switches. - build-dependency-cache is a uv project with tests: pytest checks s3_cache.py's decisions with plain values, and its restores and saves against an S3 kept in memory; node's test runner checks s3-cache.js. The build-dependency-cache workflow runs them, with ruff and ty, on pull requests that change the folder. ruff.toml copies narrative-marketplace-backend's rules, and mise.toml pins the uv and node the tests run with. - build-dependency-cache/README.md explains the archives, how to use the actions, and what's trusted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
samidalouche
force-pushed
the
feat/sc-88184/build-dependency-cache
branch
from
November 24, 2026 20:41
5a8123b to
59ed15d
Compare
lakinwecker
reviewed
Nov 30, 2026
| @@ -0,0 +1,124 @@ | |||
| # build-dependency-cache | |||
There was a problem hiding this comment.
Note: We're doing a lot of work here for what devenv almost gives us for free. No change necessary for this PR, just noting that if we were to lean into devenv more heavily we'd get so much more of this out of the box.
There was a problem hiding this comment.
To be clear: switching to devenv isn't seemless or painless, just that this kind of caching comes (mostly) for free. :D
Contributor
Author
There was a problem hiding this comment.
If devenv could simplify how we do CI / caching / etc (in ways that are complementary to Dagger?), I'm happy with the direction of devenv-ifying CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SC-88184, in epic 87120; it also covers SC-87870. narrative-marketplace-backend, narrative-connectors and narrative-snowflake-data-plane each carry an identical copy of the action that keeps sbt's dependency caches in S3 rather than GitHub's cache, which our runners reach through a NAT gateway that bills every byte. narrative-marketplace-backend#3556 replaces it with
.github/actions/build-dependency-cache: an engine and one action per tool, for sbt, mise's tools and uv's packages. This puts that folder here, file for file, for the three repositories to pin.Moving parts
s3_cache.py--kind sbt|mise|uvpicks the folders and key files. Callers never run it directly.latest; skips the download when the runner already has the keylatestat itcache-sbt(JavaScript)s3_cache.pythroughs3-cache.js.save: truesetup-mise(composite)jdx/mise-actionwith its cache off, and mise's data directory kept in S3. Composite because only a composite action can callmise-action.mise-actionmise prune --yes --tools; its save step's comment explains why first rather than lastcache-uv(JavaScript)uv.lock.uv synccache-sbtuses: narrative-io/common-github/<path>@<commit>, and a commit can't name itself;./<path>would point into the caller's checkout. So they all runs3_cache.pyfrom this repository's checkout the runner made for the action.url, which callers pass from the organization variableCOMMON_GITHUB_BUILD_DEPENDENCY_CACHE, because an action'saction.ymlcan't readvarsitself. With it empty, the step fails, so no job runs without its cache unnoticed; trouble reaching S3 still only warns. The README's new "Configure" section says how to set the variable up, without naming the bucket. Callers keep their own kill switches.build-dependency-cache/README.mdexplains the archives, use and trust. The folder is a uv project: pytest tests the engine against an S3 kept in memory,node --testthe JavaScript, and thebuild-dependency-cacheworkflow runs both, with ruff and ty, on pull requests that change the folder. The root'sruff.tomlcopies narrative-marketplace-backend's rules, and itsmise.tomlpins uv and node.The root README lists the folder under a new "Contents" section, and its "Releases" example shows an action pin as well as a workflow pin.
Release and rollout
feat:makes release-please open a release PR for v1.2.0. After it's merged, narrative-marketplace-backend#3560, narrative-connectors#377 and narrative-snowflake-data-plane#395 move their pins from this branch's commit to v1.2.0, and merge.Testing
build-dependency-cache/tests/: 60 pytest tests (the decisions as plain values; sbt, mise and uv saves and restores against an S3 kept in memory:latestfallback, scopes and projects, warm runners, excluded files, a failed extraction, an out-of-HOMEdata directory, an empty URL that fails the step; a real GNU tar and zstd round trip, which skips on macOS) and 6node --testtests (only a push to main withsave: truesaves; the step fails whenpython3does) pass, here and in narrative-marketplace-backend's copy, which differs only in the path itspyproject.tomlextends ruff's rules from.s3andframeworktests and narrative-snowflake-data-plane's four test workflows passed:cache-sbtrestored connectors' existing 5.47 GiB archive in 14s, andsetup-miseandcache-uvfound no archive yet, as expected before main saves one.🤖 Generated with Claude Code