Skip to content

Commit f8c685e

Browse files
authored
enable caching in workflows
1 parent 851bffc commit f8c685e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

.github/workflows/build_test.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ jobs:
1313
go-version: ${{ matrix.go-version }}
1414
- name: Checkout code
1515
uses: actions/checkout@v2
16+
- id: cache-paths
17+
run: |
18+
echo "::set-output name=cache::$(go env GOCACHE)"
19+
echo "::set-output name=mod-cache::$(go env GOMODCACHE)"
20+
- name: Cache go modules
21+
uses: actions/cache@v2
22+
with:
23+
path: |
24+
${{ steps.cache-paths.outputs.cache }}
25+
${{ steps.cache-paths.outputs.mod-cache }}
26+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
27+
restore-keys: ${{ runner.os }}-go-
1628
- name: Build Test v3
1729
run: |
18-
make build_test
30+
make build_test

.github/workflows/test.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ jobs:
1414
go-version: ${{ matrix.go-version }}
1515
- name: Checkout code
1616
uses: actions/checkout@v2
17+
- id: cache-paths
18+
run: |
19+
echo "::set-output name=cache::$(go env GOCACHE)"
20+
echo "::set-output name=mod-cache::$(go env GOMODCACHE)"
21+
- name: Cache go modules
22+
uses: actions/cache@v2
23+
with:
24+
path: |
25+
${{ steps.cache-paths.outputs.cache }}
26+
${{ steps.cache-paths.outputs.mod-cache }}
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: ${{ runner.os }}-go-
1729
- name: Test
1830
run: |
19-
go test ./...
31+
go test ./...

0 commit comments

Comments
 (0)