Update caching strategy in Go workflow

This commit is contained in:
Marc Brugger 2025-10-26 09:04:41 +01:00 committed by bakito
parent b78e616469
commit 75c506afd7
No known key found for this signature in database
GPG Key ID: BCCEB081DB8A24D8

View File

@ -22,12 +22,25 @@ jobs:
with:
go-version-file: "go.mod"
- 'name': 'Set up tools cache'
'uses': 'actions/cache@v4'
'with':
'path': "${{ github.workspace }}/bin"
'key': "${{ runner.os }}-${{ github.job }}-tools-${{ hashFiles('.toolbox.mk') }}"
'restore-keys': '${{ runner.os }}-${{ github.job }}-tools-'
# Cache Go build cache and module cache (speeds up module downloads & rebuilds)
- name: Cache Go modules and build cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-${{ github.job }}-go-mod-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-go-mod-
# Cache toolbox binaries produced by .toolbox.mk
- name: Cache toolbox binaries
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/bin
key: ${{ runner.os }}-${{ github.job }}-tools-${{ hashFiles('.toolbox.mk') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-tools-
- name: Lint
run: make lint
@ -49,12 +62,23 @@ jobs:
with:
go-version-file: "go.mod"
- 'name': 'Set up tools cache'
'uses': 'actions/cache@v4'
'with':
'path': "${{ github.workspace }}/bin"
'key': "${{ runner.os }}-${{ github.job }}-tools-${{ hashFiles('.toolbox.mk') }}"
'restore-keys': '${{ runner.os }}-${{ github.job }}-tools-'
- name: Cache Go modules and build cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-${{ github.job }}-go-mod-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-go-mod-
- name: Cache toolbox binaries
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/bin
key: ${{ runner.os }}-${{ github.job }}-tools-${{ hashFiles('.toolbox.mk') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-tools-
- name: Model
run: make model
@ -82,13 +106,23 @@ jobs:
with:
go-version-file: "go.mod"
- 'name': 'Set up tools cache'
'uses': 'actions/cache@v4'
'with':
'path': "${{ github.workspace }}/bin"
'key': "${{ runner.os }}-${{ github.job }}-tools-${{ hashFiles('.toolbox.mk') }}"
'restore-keys': '${{ runner.os }}-${{ github.job }}-tools-'
- name: Cache Go modules and build cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-${{ github.job }}-go-mod-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-go-mod-
- name: Cache toolbox binaries
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/bin
key: ${{ runner.os }}-${{ github.job }}-tools-${{ hashFiles('.toolbox.mk') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-tools-
- name: Run GoReleaser
run: make test-release