-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: optimize Go Mod cache (#15007)
* fix: go mod caching * fix: only cache modules
- Loading branch information
Showing
3 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Go Module Cache | ||
|
||
# This workflow is responsible for updating the Go Module Cache. | ||
# It will maintain the cache: linux-gomod-1-<hash> | ||
# All other workflows should only restore this cache. | ||
|
||
# This workflow is useful because it will: | ||
# 1. Create the cache if it doesn't exist | ||
# - This can be a problem when multiple jobs load the same cache. | ||
# Only one will get priority to create the cache. | ||
# 2. Should not fail, therefore creating a cache | ||
# - When a Job errors/fails it will not upload a new cache. | ||
# So when test/build jobs are responsible for creating the new cache, | ||
# they can fail causing cache misses on subsequent runs. Even though | ||
# the dependencies haven't changed. | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
|
||
jobs: | ||
go-cache: | ||
name: Go Cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v4.2.1 | ||
|
||
- name: Setup Go | ||
uses: ./.github/actions/setup-go | ||
with: | ||
only-modules: "true" | ||
restore-module-cache-only: "false" | ||
|
||
- name: Install Dependencies | ||
shell: bash | ||
run: go mod download all |