CI Cache Implementation (#354)
Caching adding for build and mods. Significantly improves CI `go test -v ./...`.
This commit is contained in:
parent
efaa2da1bb
commit
ecdfbbc1a8
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@ -27,9 +27,33 @@ jobs:
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: go-cache-paths
|
||||
run: |
|
||||
echo "::set-output name=go-build::$(go env GOCACHE)"
|
||||
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
||||
|
||||
- name: Cache Go build
|
||||
uses: actions/cache@v3
|
||||
id: mybuild
|
||||
with:
|
||||
path: ~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- name: Cache Go Mod
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
- name: Run go mod download
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: go mod download
|
||||
|
||||
- name: Go build
|
||||
if: steps.mybuild.outputs.cache-hit != 'true'
|
||||
run: go build ./...
|
||||
|
||||
- name: Get go-licenses
|
||||
run: go install github.com/google/go-licenses@latest
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user