Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
660e7e6
Discovery available packs up-front (#1)
Silic0nS0ldier Sep 20, 2026
531fbf9
Use GH native pagination for cache listing (#2)
Silic0nS0ldier Sep 20, 2026
778bdac
Skip reading of orphaned pack manifests (#4)
Silic0nS0ldier Sep 20, 2026
c292f47
Presence checks do not trigger pack downloads (#5)
Silic0nS0ldier Sep 20, 2026
1ecf8cf
Support compressing blobs within packs (#6)
Silic0nS0ldier Sep 20, 2026
dace1a7
Use "opaque" protobuf API and buf for codegen (#8)
Silic0nS0ldier Sep 20, 2026
23d5c9b
Generalise HTTP server in preparation for gRPC support (#9)
Silic0nS0ldier Sep 20, 2026
f356c1d
Support gRPC transport (#11)
Silic0nS0ldier Sep 20, 2026
61670a8
Source server binaries from releases rather than version control (#12)
Silic0nS0ldier Sep 20, 2026
a90cafc
Implement remote asset API for Bazel's `--remote_downloader`
Silic0nS0ldier Sep 20, 2026
52975a7
Support more checksums in remote asset API implementation (#14)
Silic0nS0ldier Sep 20, 2026
c0ddff0
Add support for tracking artifact usage (#15)
Silic0nS0ldier Sep 23, 2026
6277284
Pack optimizer (#16)
Silic0nS0ldier Sep 23, 2026
7b8dbad
Add missing `architecture` argument for optimise action (#18)
Silic0nS0ldier Sep 23, 2026
3dd59cf
Handle unreable manifests and scope deletions to current ref (#19)
Silic0nS0ldier Sep 23, 2026
c89da8f
feat: implement pack reaping functionality (#20)
Silic0nS0ldier Sep 23, 2026
049d67a
feat: allow sub-hour thresholds for pack reaping with warnings (#21)
Silic0nS0ldier Sep 23, 2026
e973b15
feat: enhance reap functionality with dry run reporting and summary u…
Silic0nS0ldier Sep 23, 2026
3deb601
feat: create spool directory in NewRepacker for cache management (#23)
Silic0nS0ldier Sep 23, 2026
3c8ba56
feat: add declared bytes tracking for restored packs and update usage…
Silic0nS0ldier Sep 23, 2026
15768a0
feat: enhance statistics presentation with human-readable byte and co…
Silic0nS0ldier Sep 23, 2026
f54c905
feat: add support for forwarding credentials to specified asset heade…
Silic0nS0ldier Sep 23, 2026
5411b57
feat: add asset request tracking and statistics to improve cache perf…
Silic0nS0ldier Sep 23, 2026
e3d9619
feat: optimize manifest loading in discover function for improved sta…
Silic0nS0ldier Sep 23, 2026
de6632c
feat: enhance miss tracking with detailed breakdown for improved cach…
Silic0nS0ldier Sep 23, 2026
859c455
feat: enhance discover function logging with detailed timing breakdow…
Silic0nS0ldier Sep 23, 2026
bedd6a3
feat: implement manifest read concurrency control and add correspondi…
Silic0nS0ldier Sep 23, 2026
3d820dc
fix: serve one of several stored action results instead of a permanen…
Silic0nS0ldier Oct 2, 2026
e6f8422
fix: stop pack flushes from stalling cache reads (#29)
Silic0nS0ldier Oct 2, 2026
d4090d4
Add devcontainer config
Silic0nS0ldier Oct 30, 2026
960a66a
Fix crash when packs contain many tiny records (decode budget exhaust…
Silic0nS0ldier Oct 30, 2026
a2a705d
Bump go and deps
Silic0nS0ldier Oct 30, 2026
5bebace
feat: age-gated optimiser with per-pack eviction and convergent resha…
Silic0nS0ldier Oct 30, 2026
35c34c6
fix: bound concurrent spool I/O to prevent thread exhaustion
Silic0nS0ldier Nov 8, 2026
70f2b05
chore: bump klauspost/compress to v1.20.2 (GO-2026-6865)
Silic0nS0ldier Nov 8, 2026
b74c786
fix: bound read-path file I/O and reuse one reader per restored pack …
Silic0nS0ldier Nov 8, 2026
88d14f5
feat: print head, crash, and tail of the server log and publish it wh…
Silic0nS0ldier Nov 8, 2026
490fb7d
Fix packed cache spool file leaks (#33)
Silic0nS0ldier Nov 8, 2026
36c4085
Serve packed objects from memory (#34)
Silic0nS0ldier Nov 8, 2026
3de947e
Fix manifest DAG head tracking (#35)
Silic0nS0ldier Nov 8, 2026
3655e1e
Reduce redundant manifest metadata (#36)
Silic0nS0ldier Nov 8, 2026
18dd2e2
Avoid re-spooling verified asset downloads (#37)
Silic0nS0ldier Nov 8, 2026
ca81407
Schedule groups to release source packs earlier (#38)
Silic0nS0ldier Nov 8, 2026
c439a8c
Avoid backend slot starvation during upload throttling (#39)
Silic0nS0ldier Nov 8, 2026
01c8dd2
Avoid canceled upload rate-limit reservations (#40)
Silic0nS0ldier Nov 8, 2026
28243e0
Skip syncs for ephemeral spool files (#41)
Silic0nS0ldier Nov 8, 2026
0f8ecc1
Add Apple Silicon macOS cache server support (#42)
Silic0nS0ldier Nov 8, 2026
0791cce
Add Windows x64 and ARM64 cache server support (#43)
Silic0nS0ldier Nov 8, 2026
1bb9570
Remove `storage-mode: objects`
Silic0nS0ldier Nov 14, 2026
c615eb6
Dead code detector
Silic0nS0ldier Nov 14, 2026
aa641e7
Bump go toolchain and dependency versions
Silic0nS0ldier Nov 14, 2026
20383b0
Tool-ify other go tools to support new go toolchain version
Silic0nS0ldier Nov 14, 2026
d6333c0
Upgrade all go deps (#45)
Silic0nS0ldier Nov 14, 2026
2d65683
Support caching Bazel's hidden lockfile
Silic0nS0ldier Dec 3, 2026
2fd7b96
Hidden lockfile result monitoring and optional fail on unexpected con…
Silic0nS0ldier Dec 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
"version": "1.1.3",
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:bd7ab48a832228f633239277552c30b353867fef2e5b037e064b4e64f0b843f2",
"integrity": "sha256:bd7ab48a832228f633239277552c30b353867fef2e5b037e064b4e64f0b843f2"
}
}
}
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "bazel-github-actions-cache-v2s",
"image": "mcr.microsoft.com/devcontainers/go:2-1.27-trixie",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"initializeCommand": {
"gh-cli-auth": "gh auth token > .git/__gh_token || true"
},
"postStartCommand": {
"gh-cli-auth": "test -s .git/__gh_token && gh auth login --with-token < .git/__gh_token || true"
}
}
87 changes: 87 additions & 0 deletions .github/actions/publish-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Publish release
description: >-
Builds the server binaries, attests their provenance, and publishes them as
assets on a tag pointing at the commit they were built from.

inputs:
version:
description: Release tag to create
required: true
prerelease:
description: Mark the release as a pre-release
required: false
default: "false"
notes:
description: Release notes body
required: true
token:
description: Token used to create the tag and publish the release
required: true

runs:
using: composite
steps:
- name: Build server binaries
shell: bash
env:
VERSION: ${{ inputs.version }}
run: scripts/build-dist.sh

# The action verifies this attestation before it will run a downloaded
# binary, which is what lets the repository ship no build output at all.
- name: Attest the build provenance
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: |
dist/cache-optimiser-linux-amd64
dist/cache-optimiser-linux-arm64
dist/cache-server-darwin-arm64
dist/cache-server-linux-amd64
dist/cache-server-linux-arm64
dist/cache-server-windows-amd64.exe
dist/cache-server-windows-arm64.exe

# The tag points at the reviewed commit itself, so the tree a consumer
# checks out is exactly the tree CI ran against.
- name: Tag the release
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
VERSION: ${{ inputs.version }}
REPOSITORY: ${{ github.repository }}
BASE_SHA: ${{ github.sha }}
run: |
set -euo pipefail
gh api --method POST "repos/$REPOSITORY/git/refs" \
--field ref="refs/tags/$VERSION" --field sha="$BASE_SHA" >/dev/null

# Immutable releases lock assets at publication, so the release is drafted,
# populated, and only then published.
- name: Publish the release
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
VERSION: ${{ inputs.version }}
NOTES: ${{ inputs.notes }}
PRERELEASE: ${{ inputs.prerelease }}
run: |
set -euo pipefail
create=(gh release create "$VERSION" --draft --verify-tag --title "$VERSION" --notes "$NOTES")
if [[ "$PRERELEASE" == "true" ]]; then
create+=(--prerelease)
fi
"${create[@]}"
gh release upload "$VERSION" \
dist/cache-optimiser-linux-amd64 \
dist/cache-optimiser-linux-arm64 \
dist/cache-server-darwin-arm64 \
dist/cache-server-linux-amd64 \
dist/cache-server-linux-arm64 \
dist/cache-server-windows-amd64.exe \
dist/cache-server-windows-arm64.exe \
dist/SHA256SUMS
publish=(gh release edit "$VERSION" --draft=false)
if [[ "$PRERELEASE" != "true" ]]; then
publish+=(--latest)
fi
"${publish[@]}"
98 changes: 92 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,102 @@ jobs:
- name: Go vet
run: go vet ./...
- name: Staticcheck
run: go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./...
run: go tool staticcheck ./...
- name: Deadcode
run: |
findings="$(go tool deadcode -test ./...)"
if [[ -n "$findings" ]]; then
printf '%s\n' "$findings"
exit 1
fi
- name: Govulncheck
run: go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...
run: go tool govulncheck ./...
- name: Node wrapper tests
run: node --test action/*.test.js
run: node --test action/*.test.js optimise/*.test.js
- name: Actionlint
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12
- name: Rebuild packaged binaries
- name: Build packaged binaries
env:
VERSION: v0.3.2
VERSION: ci-${{ github.sha }}
run: scripts/build-dist.sh
- name: Verify packaged binaries are reproducible
run: git diff --exit-code -- dist
env:
VERSION: ci-${{ github.sha }}
run: |
mv dist/SHA256SUMS "$RUNNER_TEMP/SHA256SUMS.first"
scripts/build-dist.sh
diff "$RUNNER_TEMP/SHA256SUMS.first" dist/SHA256SUMS

macos:
runs-on: macos-15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
cache: true
- name: Require Apple Silicon
run: test "$(uname -m)" = arm64
- name: Cache server Go tests with race detector
run: go test -race ./cmd/cache-server ./internal/server ./internal/cache ./internal/artifact
- name: Node cache server wrapper tests
run: node --test action/*.test.js
- name: Build packaged binaries
env:
VERSION: ci-${{ github.sha }}
run: scripts/build-dist.sh
- name: Verify packaged checksums and native server
env:
VERSION: ci-${{ github.sha }}
run: |
(cd dist && shasum -a 256 --check SHA256SUMS)
test "$(dist/cache-server-darwin-arm64 --version)" = "$VERSION"

windows:
strategy:
matrix:
include:
- runner: windows-2025
architecture: amd64
race: "-race"
- runner: windows-11-arm
architecture: arm64
race: ""
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
cache: true
architecture: ${{ matrix.architecture == 'amd64' && 'x64' || matrix.architecture }}
- name: Require native Go architecture
env:
EXPECTED_ARCH: ${{ matrix.architecture }}
run: test "$(go env GOHOSTARCH)" = "$EXPECTED_ARCH"
# Go does not support the race detector on Windows ARM64.
- name: Cache server Go tests
env:
RACE: ${{ matrix.race }}
run: |
flags=()
if [[ -n "$RACE" ]]; then
flags+=("$RACE")
fi
go test "${flags[@]}" ./cmd/cache-server ./internal/server ./internal/cache ./internal/artifact
- name: Node cache server wrapper and lifecycle tests
run: node --test action/*.test.js
- name: Build packaged binaries
env:
VERSION: ci-${{ github.sha }}
run: scripts/build-dist.sh
- name: Verify packaged checksums and native server
env:
VERSION: ci-${{ github.sha }}
ARCHITECTURE: ${{ matrix.architecture }}
run: |
(cd dist && sha256sum --check SHA256SUMS)
test "$("dist/cache-server-windows-$ARCHITECTURE.exe" --version)" = "$VERSION"
60 changes: 60 additions & 0 deletions .github/workflows/optimiser-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Optimiser smoke

# This repository has no production cache to maintain. The only packed cache it
# owns is the one the cache smoke test writes, so this workflow exists to prove
# the optimiser works against a real GitHub Actions cache, which nothing else
# covers: the unit tests run entirely against an in-memory backend.

on:
schedule:
# Weekly, purely to catch drift in the Actions REST and artifact APIs.
- cron: "17 4 * * 0"
workflow_dispatch:
inputs:
dry-run:
description: "Plan and report without publishing or deleting"
type: boolean
default: true

permissions:
contents: read

# Shared with the cache smoke test, which writes the same key prefix. Deleting
# packs out from under it would fail it for reasons that have nothing to do
# with the change under test.
concurrency:
group: bazel-smoke-cache
cancel-in-progress: false

jobs:
optimise:
runs-on: ubuntu-24.04
permissions:
contents: read
# Deleting the cache entries a pass replaces is the only thing that needs
# write.
actions: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
cache: true

# The action prefers a local dist/ over a release, so this exercises the
# code under review rather than a published binary.
- name: Build the optimiser under review
env:
VERSION: smoke-${{ github.sha }}
run: scripts/build-dist.sh

- name: Optimise the smoke cache
uses: ./optimise
with:
github-token: ${{ github.token }}
# Written by the cache smoke test; this repository has no other.
key-prefix: bazel-http-smoke-car-v1
# The smoke cache holds a single object, so the default window would
# never find enough to plan from.
min-runs: "1"
dry-run: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run || 'false' }}
42 changes: 42 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pre-release

on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pre-release
cancel-in-progress: false

jobs:
pre-release:
runs-on: ubuntu-24.04
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
cache: true
- name: Choose a timestamped version
id: version
run: echo "version=pre-$(date -u +%Y%m%dT%H%M%SZ)" >> "$GITHUB_OUTPUT"
- name: Publish
uses: ./.github/actions/publish-release
with:
version: ${{ steps.version.outputs.version }}
prerelease: "true"
token: ${{ github.token }}
notes: |
Automatic pre-release built from `${{ github.sha }}` on `main`.

Not intended for production use. Pin a `v*` release instead.
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: "Release tag, for example v0.4.0"
required: true
type: string

permissions:
contents: read

concurrency:
group: release
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-24.04
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Validate the requested version
env:
VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "version must look like v1.2.3 or v1.2.3-rc.1; got $VERSION" >&2
exit 1
fi

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Refuse to reuse an existing tag
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
if gh api "repos/$REPOSITORY/git/ref/tags/$VERSION" >/dev/null 2>&1; then
echo "tag $VERSION already exists; immutable releases cannot reuse a tag" >&2
exit 1
fi

- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: .go-version
cache: true

- name: Publish
uses: ./.github/actions/publish-release
with:
version: ${{ inputs.version }}
prerelease: "false"
token: ${{ github.token }}
notes: |
Release ${{ inputs.version }}, built from `${{ github.sha }}`.

Pin this action with:

```yaml
uses: ${{ github.repository }}@${{ inputs.version }}
```
Loading