Repository navigation
Conversation
Compare current, rolling split, and CloudX cache strategies across representative CI runners. Capture compilation, mandatory test, transfer, storage, and prebuild costs.
Restore source and dependency files after collecting cold, warm, source, and dependency CI measurements.
sdk-go Go cache proposalDecisionDo not adopt Expected pilot effect: little change when the current cache is fresh, but a Evidence set
Percentiles use linear interpolation. Times are seconds and shown as Historical baselineTwenty successful samples per row.
Stable resolved to Go 1.27.1 during the experiment; oldstable cache keys show Controlled experimentEvery unit lane ran canonical compile-only and full commands:
Across all successful phases:
The warm Linux split samples separated restore, compile, test, and save. For
Cache bytes and retention
Separation does not materially reduce restore bytes for a unit job. It reduces Repository cache use began at 10,794,448,681 bytes/16 entries, reached Cleanup deleted 15.8 GB of superseded/final PR-scoped cache entries. The final CloudXCloudX matched split on warm Linux (211 vs 211 s) but stores modules and build PrebuildThe prebuild producer and consumer are serial. Their critical-path and total Failures
Recommendation
Weekly rotation bounds writes while refreshing source state. A source-only Exact pilot changeIn the Linux/stable unit matrix lane, replace built-in setup caching with: - name: Setup Go
if: matrix.os != 'ubuntu-latest' || matrix.go-version != 'stable'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: '**/go.sum'
- name: Setup Go
if: matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable'
id: go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
cache: false
- name: Resolve Go cache
if: matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable'
id: go-cache
shell: bash
run: |
echo "build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "modules=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT"
echo "CACHE_JOB_START_MS=$(node -e 'process.stdout.write(String(Date.now()))')" >> "$GITHUB_ENV"
- name: Restore Go modules
if: matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable'
id: modules
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.0.3
with:
path: ${{ steps.go-cache.outputs.modules }}
key: go-mod-${{ runner.os }}-${{ runner.arch }}-${{ steps.go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
- name: Restore Go build cache
if: matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable'
id: build
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.0.3
with:
path: ${{ steps.go-cache.outputs.build }}
key: go-build-${{ runner.os }}-${{ runner.arch }}-unit-${{ steps.go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}-${{ steps.go-cache.outputs.week }}
restore-keys: |
go-build-${{ runner.os }}-${{ runner.arch }}-unit-${{ steps.go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}-After the unchanged canonical unit step, trim and save only on trusted main: - name: Trim Go build cache
if: success() && matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable' && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.build.outputs.cache-hit != 'true'
run: node .github/scripts/trim-go-cache.js "${{ steps.go-cache.outputs.build }}"
- name: Save Go modules
if: success() && matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable' && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.modules.outputs.cache-hit != 'true'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.0.3
with:
path: ${{ steps.go-cache.outputs.modules }}
key: ${{ steps.modules.outputs.cache-primary-key }}
- name: Save Go build cache
if: success() && matrix.os == 'ubuntu-latest' && matrix.go-version == 'stable' && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.build.outputs.cache-hit != 'true'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.0.3
with:
path: ${{ steps.go-cache.outputs.build }}
key: ${{ steps.build.outputs.cache-primary-key }}Keep current Sources and limitations
Limitations: six phase samples are enough to expose direction, cold cost, and Created resources
All workflow runs created by the branch are below.
The original worktree |
What was changed
Add a temporary CI workflow comparing current
setup-go, CloudX, and splitrolling build caches on Linux, macOS, and Windows. Measure compile-only work,
mandatory tests, transfers, cache sizes, and an Ubuntu prebuild lane.
Why?
Determine whether fresher Go build caches reduce end-to-end CI time without
causing storage churn. This draft PR is experimental and must not merge.
Checklist
Closes: N/A
How was this tested:
go run . checkgo run . unit-test -run '^$'go test -count 1 -race -run '^$' ./...fromtest