CI Cache Implementation (#354)

Caching adding for build and mods. Significantly improves CI `go test -v ./...`.
This commit is contained in:
Danny 2022-07-15 16:54:24 -04:00 committed by GitHub
parent efaa2da1bb
commit ecdfbbc1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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