Separate caches #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.x" | |
cache: false | |
- name: Get Go cached paths | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
- name: Set up dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.cache }} | |
key: setup-go-deps-${{ hashFiles('go.sum go.mod') }} | |
restore-keys: | | |
setup-go-deps- | |
- name: Set up intermediate built files cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.modcache }} | |
key: setup-go-build-${{ hashFiles('**/*.go') }} | |
restore-keys: | | |
setup-go-build- | |
- name: get | |
run: | | |
go get | |
- name: build | |
run: | | |
go build |