Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

ci(release-check): read linux-package-smoke's build cache (#1165)

kyle-elliott-asymptotefd4325beb684
diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml
index 3bb00d3b..95ff17ab 100644
--- a/.github/actions/setup-go/action.yml
+++ b/.github/actions/setup-go/action.yml
@@ -23,6 +23,15 @@ inputs:
already part of the key.
required: false
default: ""
+ cache-job:
+ description: >
+ Build cache to use instead of this job's own, named by the job that
+ writes it. Only pushes to main save build caches, so a job that is never
+ part of one never has a cache; it can name a main job that compiles the
+ same packages. A named cache is only ever restored, never saved, on any
+ ref, so a dispatch on main cannot write into the other job's entries.
+ required: false
+ default: ""
runs:
using: composite
@@ -51,7 +60,7 @@ runs:
shell: bash
env:
MODULES: ${{ inputs.modules }}
- JOB: ${{ github.job }}${{ inputs.cache-key && format('-{0}', inputs.cache-key) || '' }}
+ JOB: ${{ inputs.cache-job || github.job }}${{ inputs.cache-key && format('-{0}', inputs.cache-key) || '' }}
run: |
set -euo pipefail
sums=()
@@ -88,13 +97,15 @@ runs:
key: ${{ steps.keys.outputs.mod-key }}
restore-keys: ${{ steps.keys.outputs.mod-prefix }}
- - if: github.ref == 'refs/heads/main'
+ # A borrowed build cache (cache-job) is only ever restored, on any ref: a manual dispatch on main
+ # would otherwise save this job's build under the other job's key and could take its entry.
+ - if: github.ref == 'refs/heads/main' && inputs.cache-job == ''
uses: actions/cache@v6
with:
path: ${{ steps.keys.outputs.gocache }}
key: ${{ steps.keys.outputs.build-key }}
restore-keys: ${{ steps.keys.outputs.build-prefix }}
- - if: github.ref != 'refs/heads/main'
+ - if: github.ref != 'refs/heads/main' || inputs.cache-job != ''
uses: actions/cache/restore@v6
with:
path: ${{ steps.keys.outputs.gocache }}
diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml
index 6d587e8b..8f045b0a 100644
--- a/.github/workflows/release-check.yml
+++ b/.github/workflows/release-check.yml
@@ -41,6 +41,11 @@ jobs:
cli/beacon
cli/beacon-hooks
collector-builder/exporter/beaconjsonexporter
+ # This job is never part of a push to main, so it never saves a build cache of its own. It
+ # reads linux-package-smoke's, which compiles the same three modules and the linux/amd64
+ # collector on every push to main, and never writes to it, even when dispatched on main.
+ # If that job stops building the collector, this one still works, only colder.
+ cache-job: linux-package-smoke
- uses: goreleaser/goreleaser-action@v7
with:
# Keep formulas working until we intentionally migrate the tap to casks.