.github/workflows: add Go version to Go artifacts cache key

When Go version changes, artifacts for the previous Go version may becomes useless,
so there is a little sense in re-using them.
This commit is contained in:
Aliaksandr Valialkin 2023-11-21 12:00:47 +02:00
parent 74fda0b311
commit 5d1ce9891b
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
2 changed files with 12 additions and 7 deletions

View file

@ -14,14 +14,16 @@ jobs:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Code checkout
uses: actions/checkout@master
- name: Setup Go - name: Setup Go
id: go
uses: actions/setup-go@main uses: actions/setup-go@main
with: with:
go-version: stable go-version: stable
cache: false cache: false
id: go
- name: Code checkout
uses: actions/checkout@master
- name: Cache Go artifacts - name: Cache Go artifacts
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
@ -29,7 +31,8 @@ jobs:
~/.cache/go-build ~/.cache/go-build
~/go/pkg/mod ~/go/pkg/mod
~/go/bin ~/go/bin
key: go-artifacts-${{ runner.os }}-check-licenses-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }} key: go-artifacts-${{ runner.os }}-check-licenses-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }}
restore-keys: go-artifacts-${{ runner.os }}-check-licenses- restore-keys: go-artifacts-${{ runner.os }}-check-licenses-
- name: Check License - name: Check License
run: make check-licenses run: make check-licenses

View file

@ -30,6 +30,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Go - name: Setup Go
id: go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: stable go-version: stable
@ -42,7 +43,7 @@ jobs:
~/.cache/go-build ~/.cache/go-build
~/go/pkg/mod ~/go/pkg/mod
~/go/bin ~/go/bin
key: go-artifacts-${{ runner.os }}-check-all-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }} key: go-artifacts-${{ runner.os }}-check-all-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }}
restore-keys: go-artifacts-${{ runner.os }}-check-all- restore-keys: go-artifacts-${{ runner.os }}-check-all-
- name: Run check-all - name: Run check-all
@ -72,7 +73,7 @@ jobs:
~/.cache/go-build ~/.cache/go-build
~/go/pkg/mod ~/go/pkg/mod
~/go/bin ~/go/bin
key: go-artifacts-${{ runner.os }}-crossbuild-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }} key: go-artifacts-${{ runner.os }}-crossbuild-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }}
restore-keys: go-artifacts-${{ runner.os }}-crossbuild- restore-keys: go-artifacts-${{ runner.os }}-crossbuild-
- name: Build - name: Build
@ -90,6 +91,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Go - name: Setup Go
id: go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: stable go-version: stable
@ -102,7 +104,7 @@ jobs:
~/.cache/go-build ~/.cache/go-build
~/go/pkg/mod ~/go/pkg/mod
~/go/bin ~/go/bin
key: go-artifacts-${{ runner.os }}-${{ matrix.scenario }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }} key: go-artifacts-${{ runner.os }}-${{ matrix.scenario }}-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.sum', 'Makefile', 'app/**/Makefile') }}
restore-keys: go-artifacts-${{ runner.os }}-${{ matrix.scenario }}- restore-keys: go-artifacts-${{ runner.os }}-${{ matrix.scenario }}-
- name: run tests - name: run tests