From fb913d092748b96e5158b1beb7609651ce781e4a Mon Sep 17 00:00:00 2001 From: Josh Carp Date: Fri, 24 Apr 2026 23:05:38 -0400 Subject: [PATCH] Cache go tool dependencies. Configure the setup-go action to cache dependencies for both go.sum and tools/go.sum. Otherwise, we'll download all tool dependencies fresh on every run. We also cache golangci-lint state, since linting from a cold cache can take multiple minutes. --- .github/workflows/lint-fmt.yaml | 22 ++++++++++++++++++++++ .github/workflows/manifest.yaml | 3 +++ .github/workflows/release.yaml | 3 +++ 3 files changed, 28 insertions(+) diff --git a/.github/workflows/lint-fmt.yaml b/.github/workflows/lint-fmt.yaml index 4b7a7c2..312ef60 100644 --- a/.github/workflows/lint-fmt.yaml +++ b/.github/workflows/lint-fmt.yaml @@ -16,6 +16,17 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod + cache-dependency-path: | + go.sum + tools/go.sum + + - name: Cache golangci-lint analysis + uses: actions/cache@v4 + with: + path: ~/.cache/golangci-lint + key: golangci-lint-${{ runner.os }}-${{ hashFiles('tools/go.sum', '.golangci.yaml', 'go.mod') }} + restore-keys: | + golangci-lint-${{ runner.os }}- - name: Lint run: make lint @@ -31,6 +42,17 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod + cache-dependency-path: | + go.sum + tools/go.sum + + - name: Cache golangci-lint analysis + uses: actions/cache@v4 + with: + path: ~/.cache/golangci-lint + key: golangci-lint-${{ runner.os }}-${{ hashFiles('tools/go.sum', '.golangci.yaml', 'go.mod') }} + restore-keys: | + golangci-lint-${{ runner.os }}- - name: Format run: make fmt diff --git a/.github/workflows/manifest.yaml b/.github/workflows/manifest.yaml index 197ddaf..5caf3bf 100644 --- a/.github/workflows/manifest.yaml +++ b/.github/workflows/manifest.yaml @@ -16,6 +16,9 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: go.mod + cache-dependency-path: | + go.sum + tools/go.sum - name: Generate Manifest run: make manifest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4f9b222..3287257 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -86,6 +86,9 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: go.mod + cache-dependency-path: | + go.sum + tools/go.sum - uses: docker/login-action@v3 with: