Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add Windows image version to cache key #4098

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ runs:
echo "GOMODCACHE=D:\\golang\\modcache" >> $GITHUB_ENV
echo "GOPATH=D:\\golang\\go" >> $GITHUB_ENV
echo "USERPROFILE=D:\\homedir" >> $GITHUB_ENV
echo "OS_EXTRA_VERSION=${ImageVersion}-v2-" >> $GITHUB_ENV
elif [ "$RUNNER_OS" = "macOS" ]; then
echo "GOCACHE=/Users/runner/go/pkg/mod" >> $GITHUB_ENV
echo "GOMODCACHE=/Users/runner/Library/Caches/go-build" >> $GITHUB_ENV
Expand All @@ -36,18 +37,18 @@ runs:
path: |
${{ env.GOCACHE }}
${{ env.GOMODCACHE }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}
- uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a
if: ${{ inputs.upload-cache != 'true' }}
with:
path: |
${{ env.GOCACHE }}
${{ env.GOMODCACHE }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
with:
cache: false
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
filters: |
code:
- '**/*.go'
- '.github/actions/setup-go/action.yml'
- '.github/workflows/main.yml'
- '.goreleaser.yaml'
- 'Makefile'
Expand Down Expand Up @@ -359,7 +360,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}
- name: build
run: |
go build -v ./...
go build -v -x ./...
- name: run
run: |
go run . --version
Expand Down
Loading