From 5b8e3c0f99455af97ad4251b17aff8575ad5d1c7 Mon Sep 17 00:00:00 2001 From: Ruslan Sayfutdinov Date: Wed, 6 Nov 2024 19:33:56 +0000 Subject: [PATCH] chore: Optimize Go caches in Github Actions --- .github/workflows/main.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c62aca558f3..f4e770e2dc1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,6 +65,14 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: fetch-depth: 1 + - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: setup-go-${{ runner.os }}-x64-ubuntu22-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + setup-go-${{ runner.os }}-x64-ubuntu22-go-${{ env.GO_VERSION }}- - uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd with: languages: go @@ -284,9 +292,6 @@ jobs: contents: read steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed - with: - go-version: ${{ env.GO_VERSION }} - uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 with: version: ${{ env.UV_VERSION }} @@ -308,13 +313,8 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed with: + cache: false go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - name: build run: | go build ./... @@ -390,6 +390,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed with: + cache: ${{ runner.os != 'Windows' }} go-version: stable - uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 with: @@ -456,9 +457,6 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: fetch-depth: 0 - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed - with: - go-version: ${{ env.GO_VERSION }} - uses: astral-sh/setup-uv@3b9817b1bf26186f03ab8277bab9b827ea5cc254 with: version: ${{ env.UV_VERSION }}