Skip to content

Commit 92aa87a

Browse files
authored
Refine CI workflow caching and dev as default make target (#120)
* Refine CI workflow caching * Change default Make target * go mod tidy
1 parent d4193cb commit 92aa87a

File tree

5 files changed

+45
-74
lines changed

5 files changed

+45
-74
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,43 @@ jobs:
2323
- uses: actions/checkout@v2
2424
with:
2525
fetch-depth: 0
26-
- uses: actions/cache@v2
27-
with:
28-
path: ~/go/pkg/mod
29-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
26+
3027
- uses: actions/setup-go@v2
3128
with:
32-
go-version: ${{ matrix.go-version }}
29+
go-version: 1.16
30+
31+
- id: go-cache-paths
32+
name: Get Go Cache paths
33+
run: |
34+
echo "::set-output name=go-build::$(go env GOCACHE)"
35+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
36+
37+
- name: Go Build Cache
38+
uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.go-cache-paths.outputs.go-build }}
41+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
42+
43+
- name: Go Mod Cache
44+
uses: actions/cache@v2
45+
with:
46+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
47+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
48+
3349
- name: Build
3450
run: make ci
3551
- name: Upload coverage
3652
uses: actions/upload-artifact@v2
3753
with:
3854
name: coverage
3955
path: coverage.*
56+
4057
- name: Upload dist
4158
uses: actions/upload-artifact@v2
4259
with:
4360
name: dist
4461
path: dist
62+
4563
- name: Upload coverage to Codecov
4664
uses: codecov/codecov-action@v1
4765
with:

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,29 @@ jobs:
1212
- uses: actions/checkout@v2
1313
with:
1414
fetch-depth: 0
15+
1516
- uses: actions/setup-go@v2
1617
with:
1718
go-version: 1.16
19+
20+
- id: go-cache-paths
21+
name: Get Go Cache paths
22+
run: |
23+
echo "::set-output name=go-build::$(go env GOCACHE)"
24+
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
25+
26+
- name: Go Build Cache
27+
uses: actions/cache@v2
28+
with:
29+
path: ${{ steps.go-cache-paths.outputs.go-build }}
30+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
31+
32+
- name: Go Mod Cache
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ steps.go-cache-paths.outputs.go-mod }}
36+
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
37+
1838
- name: Release
1939
run: make release
2040
env:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.DEFAULT_GOAL := help
1+
.DEFAULT_GOAL := dev
22

33
.PHONY: dev
44
dev: ## dev build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ It includes:
3939

4040
## Build
4141

42-
- Terminal: `make` to get help for make targets.
42+
- Terminal: `make help` to get help for make targets.
4343
- Visual Studio Code: `Terminal``Run Build Task... (CTRL+ALT+B)` to execute a fast build.
4444

4545
## Release

0 commit comments

Comments
 (0)