Skip to content

Commit 66c83dc

Browse files
authored
ci: update workflow actions and makefile tools setup (#5)
1 parent fc69fe9 commit 66c83dc

File tree

2 files changed

+19
-37
lines changed

2 files changed

+19
-37
lines changed

.github/workflows/ci.yml

+13-27
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ jobs:
77
name: Lint
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-go@v4
12+
with:
13+
go-version: 1.18
14+
cache: false
1115
- name: golangci-lint
12-
uses: golangci/golangci-lint-action@v2
16+
uses: golangci/golangci-lint-action@v3
1317
with:
1418
version: v1.54
1519
env:
@@ -19,35 +23,23 @@ jobs:
1923
name: Tidy
2024
runs-on: ubuntu-latest
2125
steps:
22-
- uses: actions/checkout@v2
23-
- uses: actions/setup-go@v2
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-go@v4
2428
with:
2529
go-version: 1.18
26-
- uses: actions/cache@v2
27-
with:
28-
path: ~/go/pkg/mod
29-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30-
restore-keys: |
31-
${{ runner.os }}-go-
3230
- name: Check if mods are tidy
3331
run: make check-tidy
3432

3533
cov:
3634
name: Coverage
3735
runs-on: ubuntu-latest
3836
steps:
39-
- uses: actions/checkout@v2
40-
- uses: actions/setup-go@v2
37+
- uses: actions/checkout@v3
38+
- uses: actions/setup-go@v4
4139
with:
4240
go-version: 1.18
43-
- uses: actions/cache@v2
44-
with:
45-
path: ~/go/pkg/mod
46-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47-
restore-keys: |
48-
${{ runner.os }}-go-
4941
- name: Publish coverage
50-
uses: paambaati/codeclimate-action@v2.7.4
42+
uses: paambaati/codeclimate-action@v5.0.0
5143
env:
5244
VERBOSE: "true"
5345
GOMAXPROCS: 4
@@ -70,16 +62,10 @@ jobs:
7062
- "1.21"
7163
runs-on: ubuntu-latest
7264
steps:
73-
- uses: actions/checkout@v2
74-
- uses: actions/setup-go@v2
65+
- uses: actions/checkout@v3
66+
- uses: actions/setup-go@v4
7567
with:
7668
go-version: ${{ matrix.go_version }}
77-
- uses: actions/cache@v2
78-
with:
79-
path: ~/go/pkg/mod
80-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
81-
restore-keys: |
82-
${{ runner.os }}-go-
8369
- name: Run tests
8470
run: go test -v -count=1 -race ./...
8571

Makefile

+6-10
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,19 @@ SHELL := env \
3434
# Tools
3535
#
3636

37-
TOOLS += $(TOOLDIR)/gobin
38-
$(TOOLDIR)/gobin:
39-
GO111MODULE=off go get -u github.com/myitcv/gobin
40-
4137
# external tool
4238
define tool # 1: binary-name, 2: go-import-path
4339
TOOLS += $(TOOLDIR)/$(1)
4440

45-
$(TOOLDIR)/$(1): $(TOOLDIR)/gobin Makefile
46-
gobin $(V) "$(2)"
41+
$(TOOLDIR)/$(1): Makefile
42+
GOBIN="$(CURDIR)/$(TOOLDIR)" go install "$(2)"
4743
endef
4844

49-
$(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc))
50-
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt))
51-
$(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports))
45+
$(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc@latest))
46+
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
47+
$(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports@latest))
5248
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/[email protected]))
53-
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod))
49+
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
5450

5551
.PHONY: tools
5652
tools: $(TOOLS)

0 commit comments

Comments
 (0)