From faa9163e9645bd737244305c48a2b13788dbca10 Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Wed, 5 Aug 2026 14:03:13 +0300 Subject: [PATCH] ci: cache the assembled scss tree Move the cacher bootstrap to the first task and assemble the shared sourcehut scss partials in ~/scss behind a cache keyed by CORE_VER+BOOTSTRAP_REV. On a hit the build no longer talks to git.sr.ht or github.com at all, so their outages can't fail it; a pin bump misses and reassembles from source as before. --- .build.yml | 60 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/.build.yml b/.build.yml index 8c3e9bdd0134c886ef3f54e188c507f28800e390..4b6fe98042d50d32af8a106363d1970b10d0b4a2 100644 --- a/.build.yml +++ b/.build.yml @@ -32,19 +32,45 @@ submitter: allow-refs: - refs/heads/master tasks: + - cacher: | + # S3-backed CI cache helper (go.bigb.es/cacher), dogfooded from its own + # published release — the same bootstrap the bencher/ci-cacher builds use. + # First task, so the scss assembly below can already use the cache. + mkdir -p ~/.local/bin + curl -sSL "https://bigbes.pages.srht.bigb.es/ci-cacher/cacher-linux-amd64" \ + -o ~/.local/bin/cacher + chmod +x ~/.local/bin/cacher + echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.buildenv + export PATH="$HOME/.local/bin:$PATH" + cacher init \ + --endpoint https://s3.bigb.es \ + --region garage \ + --bucket docker-cache \ + --prefix sr-ht-spec/deps \ + --key-file ~/.s3-cache-key-id \ + --secret-file ~/.s3-cache-key-secret - scss: | # No apk ships the shared sourcehut SCSS partials, so assemble them the # way core.sr.ht's `make install-scss` would: its own scss/ plus the # Bootstrap 4 submodule. `make css` runs sassc -I against this tree. - git clone --depth 1 --branch "$CORE_VER" \ - https://git.sr.ht/~sircmpwn/core.sr.ht /tmp/core - sudo mkdir -p /usr/share/sourcehut/scss/bootstrap - sudo cp /tmp/core/scss/*.scss /tmp/core/scss/*.css /usr/share/sourcehut/scss/ - git init -q /tmp/bootstrap - git -C /tmp/bootstrap remote add origin https://github.com/twbs/bootstrap - git -C /tmp/bootstrap fetch -q --depth 1 origin "$BOOTSTRAP_REV" - git -C /tmp/bootstrap checkout -q FETCH_HEAD - sudo cp -r /tmp/bootstrap/scss /usr/share/sourcehut/scss/bootstrap/scss + # The assembled tree is cached keyed by the two pins — on a hit this + # task touches neither git.sr.ht nor github.com, so their outages can't + # fail the build. + KEY_SCSS="scss/${CORE_VER}-${BOOTSTRAP_REV}.tar.zst" + if ! cacher dir download "$KEY_SCSS" ~/scss; then + git clone --depth 1 --branch "$CORE_VER" \ + https://git.sr.ht/~sircmpwn/core.sr.ht /tmp/core + mkdir -p ~/scss/bootstrap + cp /tmp/core/scss/*.scss /tmp/core/scss/*.css ~/scss/ + git init -q /tmp/bootstrap + git -C /tmp/bootstrap remote add origin https://github.com/twbs/bootstrap + git -C /tmp/bootstrap fetch -q --depth 1 origin "$BOOTSTRAP_REV" + git -C /tmp/bootstrap checkout -q FETCH_HEAD + cp -r /tmp/bootstrap/scss ~/scss/bootstrap/scss + cacher dir upload "$KEY_SCSS" ~/scss + fi + sudo mkdir -p /usr/share/sourcehut + sudo cp -r ~/scss /usr/share/sourcehut/scss - keygen: | # abuild insists on signing what it builds, but this key is deliberately # throwaway: generated per build, dies with the VM, trusted by nothing. @@ -62,22 +88,6 @@ tasks: sed -i "s/^pkgver=.*/pkgver=$ver/" APKBUILD echo "export PKGVER=$ver" >> ~/.buildenv echo "building $ver" - - cacher: | - # S3-backed CI cache helper (go.bigb.es/cacher), dogfooded from its own - # published release — the same bootstrap the bencher/ci-cacher builds use. - mkdir -p ~/.local/bin - curl -sSL "https://bigbes.pages.srht.bigb.es/ci-cacher/cacher-linux-amd64" \ - -o ~/.local/bin/cacher - chmod +x ~/.local/bin/cacher - echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.buildenv - export PATH="$HOME/.local/bin:$PATH" - cacher init \ - --endpoint https://s3.bigb.es \ - --region garage \ - --bucket docker-cache \ - --prefix sr-ht-spec/deps \ - --key-file ~/.s3-cache-key-id \ - --secret-file ~/.s3-cache-key-secret - cache_restore: | # Restore the Go module and build caches, both keyed by go.sum: the # dependency tree dominates compile time, and it only changes when go.sum