Skip to content

Commit

Permalink
chore: add setup/go cache
Browse files Browse the repository at this point in the history
  • Loading branch information
kazami139 committed Mar 26, 2023
1 parent d159dc2 commit 9f47527
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/eoefans-api-docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,32 @@ jobs:
ls config
cat config/version
- uses: actions/setup-go@v4
- uses: actions/setup-go@main
with:
go-version: '^1.18'
cache-dependency-path: ./go.sum
cache: true
- run: go version

- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: go dependencies
run: go mod download

Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/eoefans-spider-docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,32 @@ jobs:
ls config
cat config/version
- uses: actions/setup-go@v4
- uses: actions/setup-go@main
with:
go-version: '^1.18'
cache-dependency-path: ./go.sum
cache: true
- run: go version

- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}

# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}

- name: go dependencies
run: go mod download

Expand Down

0 comments on commit 9f47527

Please sign in to comment.