From 0f83d915a551928744704ddf5ea431f5dce7d2a1 Mon Sep 17 00:00:00 2001 From: David Kang Date: Wed, 15 May 2024 16:47:31 -0700 Subject: [PATCH] Add proper Go caching for CI (#402) * Add proper Go caching for CI * Fix cache paths --- .github/workflows/ci.yaml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a0ad767f..0fe2051d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,7 +4,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Configure git for private modules env: TOKEN: ${{ secrets.CI_PERSONAL_ACCESS_TOKEN }} @@ -16,12 +16,25 @@ jobs: github_token: ${{ secrets.CI_PERSONAL_ACCESS_TOKEN }} - uses: bufbuild/buf-lint-action@v1 - name: setup-go - if: success() - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version-file: go.mod + - name: go-cache + uses: actions/cache@v4 + with: + # Go bin cache, mod cache, build cache, etc. - these are custom set by makego + # which is why actions/setup-go can't handle caching properly + # Also hash by makefiles because some things (like golangcilint version) are defined there + path: | + ~/.cache/cli/${{ runner.os }}/x86_64/bin + ~/.cache/cli/${{ runner.os }}/x86_64/go/pkg/mod + ~/.cache/cli/${{ runner.os }}/x86_64/gocache + ~/.cache/cli/${{ runner.os }}/x86_64/include + ~/.cache/cli/${{ runner.os }}/x86_64/versions + ~/.cache/cli/${{ runner.os }}/x86_64/golangci-lint + key: go-cache-cli-${{ hashFiles('go.sum', 'make/**') }} + restore-keys: go-cache-cli- - name: ci env: GITHUB_TOKEN: ${{ secrets.CI_PERSONAL_ACCESS_TOKEN }} - if: success() run: make ci