From 304f127d34d6d710ab00559fe28dbbfdb19deec7 Mon Sep 17 00:00:00 2001 From: Ethan <39577870+ethanndickson@users.noreply.github.com> Date: Wed, 15 Jul 2026 18:35:18 +1000 Subject: [PATCH] ci(.github): remove the go-cache action (#27250) Closes https://github.com/coder/internal/issues/1619 Closes ENG-3039 Closes https://github.com/coder/internal/issues/1002 Closes ENG-3018 The `test-go-pg` Go cache grew until the post-job save could no longer complete within the job timeout, cancelling the job on every `main` run. Depot runners already provide remote Go build caching via [`GOCACHEPROG`](https://depot.dev/docs/cache/integrations/gocache), which writes every object it serves into `GOCACHE` and never evicts, so persisting `GOCACHE` with `actions/cache` on top just carries an ever-growing directory forward. #20510 removed the custom build cache steps for exactly this reason, and the `go-cache` action introduced in #25727 unintentionally reinstated them. The action is now removed entirely, along with its module cache persistence: a full cache miss plus cold `go mod download` on a Depot runner takes about 10 seconds, faster than any warm `actions/cache` restore of the module cache was. `setup-go-paths` is kept, as it points `GOCACHE` and friends at the Windows RAM disk, but its now-unused caching-related outputs are removed. --- .github/actions/go-cache/action.yml | 76 ----------------------- .github/actions/setup-go-paths/action.yml | 25 -------- .github/workflows/ci.yaml | 39 ------------ .github/workflows/flake-go.yaml | 3 - .github/workflows/nightly-gauntlet.yaml | 3 - .github/workflows/pr-deploy.yaml | 3 - .github/workflows/security.yaml | 3 - 7 files changed, 152 deletions(-) delete mode 100644 .github/actions/go-cache/action.yml diff --git a/.github/actions/go-cache/action.yml b/.github/actions/go-cache/action.yml deleted file mode 100644 index d77abaedec..0000000000 --- a/.github/actions/go-cache/action.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: "Go cache" -description: Restore and save Go build and module caches. -inputs: - cache-path: - description: "Optional newline-delimited cache paths. Defaults to go env GOCACHE and GOMODCACHE." - required: false - default: "" - key-prefix: - description: "Prefix for the cache key." - required: false - default: "go" - download-modules: - description: "Whether to run go mod download after restoring cache." - required: false - default: "true" -runs: - using: "composite" - steps: - - name: Compute Go cache key - id: go-cache - shell: bash - run: | - set -euo pipefail - - if [[ -n "${INPUT_CACHE_PATH}" ]]; then - paths="${INPUT_CACHE_PATH}" - else - paths="$(printf '%s\n%s' "$(go env GOCACHE)" "$(go env GOMODCACHE)")" - fi - - go_version="$(go env GOVERSION)" - paths_hash="$(printf '%s\n' "${paths}" | git hash-object --stdin)" - hash="$( - { - printf '%s\n' "${go_version}" - for file in go.mod go.sum; do - if [[ -f "${file}" ]]; then - git hash-object "${file}" - fi - done - } | git hash-object --stdin - )" - - { - echo "path<> "$GITHUB_OUTPUT" - env: - INPUT_CACHE_PATH: ${{ inputs.cache-path }} - INPUT_KEY_PREFIX: ${{ inputs.key-prefix }} - - - name: Restore Go cache, save on main - if: ${{ github.ref == 'refs/heads/main' }} - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ${{ steps.go-cache.outputs.path }} - key: ${{ steps.go-cache.outputs.key }} - restore-keys: | - ${{ steps.go-cache.outputs.restore-key }} - - - name: Restore Go cache read-only - if: ${{ github.ref != 'refs/heads/main' }} - uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: ${{ steps.go-cache.outputs.path }} - key: ${{ steps.go-cache.outputs.key }} - restore-keys: | - ${{ steps.go-cache.outputs.restore-key }} - - - name: Download Go modules - if: ${{ inputs.download-modules == 'true' }} - shell: bash - run: ./.github/scripts/retry.sh -- go mod download -x diff --git a/.github/actions/setup-go-paths/action.yml b/.github/actions/setup-go-paths/action.yml index 8423ddb4c5..f50efab986 100644 --- a/.github/actions/setup-go-paths/action.yml +++ b/.github/actions/setup-go-paths/action.yml @@ -1,26 +1,9 @@ name: "Setup Go Paths" description: Overrides Go paths like GOCACHE and GOMODCACHE to use temporary directories. -outputs: - gocache: - description: "Value of GOCACHE" - value: ${{ steps.paths.outputs.gocache }} - gomodcache: - description: "Value of GOMODCACHE" - value: ${{ steps.paths.outputs.gomodcache }} - gopath: - description: "Value of GOPATH" - value: ${{ steps.paths.outputs.gopath }} - gotmp: - description: "Value of GOTMPDIR" - value: ${{ steps.paths.outputs.gotmp }} - cached-dirs: - description: "Go directories that should be cached between CI runs" - value: ${{ steps.paths.outputs.cached-dirs }} runs: using: "composite" steps: - name: Override Go paths - id: paths uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | @@ -39,14 +22,6 @@ runs: core.exportVariable('GOPATH', gopathDir); core.exportVariable('GOTMPDIR', gotmpDir); - core.setOutput('gocache', gocacheDir); - core.setOutput('gomodcache', gomodcacheDir); - core.setOutput('gopath', gopathDir); - core.setOutput('gotmp', gotmpDir); - - const cachedDirs = `${gocacheDir}\n${gomodcacheDir}`; - core.setOutput('cached-dirs', cachedDirs); - - name: Create directories shell: bash run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cedc349858..a81b7a9115 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -332,9 +332,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:github.com/golangci/golangci-lint/cmd/golangci-lint go:github.com/coder/paralleltestctx/cmd/paralleltestctx @@ -445,9 +442,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:storj.io/drpc/cmd/protoc-gen-go-drpc go:github.com/coder/sqlc/cmd/sqlc @@ -506,9 +500,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:mvdan.cc/sh/v3/cmd/shfmt @@ -571,7 +562,6 @@ jobs: persist-credentials: false - name: Setup Go Paths - id: go-paths uses: ./.github/actions/setup-go-paths - name: Setup GNU tools (macOS) @@ -582,11 +572,6 @@ jobs: with: install-args: "go terraform" - - name: Restore Go cache - uses: ./.github/actions/go-cache - with: - cache-path: ${{ steps.go-paths.outputs.cached-dirs }} - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:gotest.tools/gotestsum go:github.com/slsyy/mtimehash/cmd/mtimehash @@ -762,9 +747,6 @@ jobs: with: install-args: "go terraform" - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:gotest.tools/gotestsum @@ -836,9 +818,6 @@ jobs: with: install-args: "go terraform" - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:gotest.tools/gotestsum @@ -920,9 +899,6 @@ jobs: with: install-args: "go" - - name: Restore Go cache - uses: ./.github/actions/go-cache - # Used by some integration tests. - name: Install Nginx run: sudo apt-get update && sudo apt-get install -y nginx @@ -993,9 +969,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - # Assume that the checked-in versions are up-to-date - run: make gen/mark-fresh name: make gen @@ -1120,9 +1093,6 @@ jobs: with: directory: offlinedocs - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:storj.io/drpc/cmd/protoc-gen-go-drpc go:github.com/coder/sqlc/cmd/sqlc @@ -1224,9 +1194,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:github.com/tc-hib/go-winres go:github.com/goreleaser/nfpm/v2/cmd/nfpm @@ -1287,9 +1254,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:github.com/tc-hib/go-winres go:github.com/goreleaser/nfpm/v2/cmd/nfpm @@ -1646,9 +1610,6 @@ jobs: with: install-args: "go" - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:github.com/coder/sqlc/cmd/sqlc diff --git a/.github/workflows/flake-go.yaml b/.github/workflows/flake-go.yaml index bf31e9b4df..1f3439a7ae 100644 --- a/.github/workflows/flake-go.yaml +++ b/.github/workflows/flake-go.yaml @@ -47,9 +47,6 @@ jobs: with: install-args: "go" - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:github.com/coder/whichtests go:gotest.tools/gotestsum diff --git a/.github/workflows/nightly-gauntlet.yaml b/.github/workflows/nightly-gauntlet.yaml index 5ce98a0d65..3c3540cd12 100644 --- a/.github/workflows/nightly-gauntlet.yaml +++ b/.github/workflows/nightly-gauntlet.yaml @@ -67,9 +67,6 @@ jobs: with: install-args: "go terraform" - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:gotest.tools/gotestsum diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index fa92ee8ba2..2306e2694c 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -246,9 +246,6 @@ jobs: - name: Install pnpm dependencies uses: ./.github/actions/pnpm-install - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Install Go mise tools run: ./.github/scripts/retry.sh -- mise install --locked go:github.com/coder/sqlc/cmd/sqlc diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 2f7f7ab9dd..268a47f3a8 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -41,9 +41,6 @@ jobs: with: install-args: "go" - - name: Restore Go cache - uses: ./.github/actions/go-cache - - name: Initialize CodeQL uses: github/codeql-action/init@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # v3.29.5 with: