mirror of
https://github.com/romdo/gomockctx.git
synced 2026-02-19 08:06:40 +00:00
ci: update workflow actions and makefile tools setup (#5)
This commit is contained in:
40
.github/workflows/ci.yml
vendored
40
.github/workflows/ci.yml
vendored
@@ -7,9 +7,13 @@ jobs:
|
|||||||
name: Lint
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.18
|
||||||
|
cache: false
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v2
|
uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
version: v1.54
|
version: v1.54
|
||||||
env:
|
env:
|
||||||
@@ -19,16 +23,10 @@ jobs:
|
|||||||
name: Tidy
|
name: Tidy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
- name: Check if mods are tidy
|
- name: Check if mods are tidy
|
||||||
run: make check-tidy
|
run: make check-tidy
|
||||||
|
|
||||||
@@ -36,18 +34,12 @@ jobs:
|
|||||||
name: Coverage
|
name: Coverage
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
- name: Publish coverage
|
- name: Publish coverage
|
||||||
uses: paambaati/codeclimate-action@v2.7.4
|
uses: paambaati/codeclimate-action@v5.0.0
|
||||||
env:
|
env:
|
||||||
VERBOSE: "true"
|
VERBOSE: "true"
|
||||||
GOMAXPROCS: 4
|
GOMAXPROCS: 4
|
||||||
@@ -70,16 +62,10 @@ jobs:
|
|||||||
- "1.21"
|
- "1.21"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go_version }}
|
go-version: ${{ matrix.go_version }}
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -v -count=1 -race ./...
|
run: go test -v -count=1 -race ./...
|
||||||
|
|
||||||
|
|||||||
16
Makefile
16
Makefile
@@ -34,23 +34,19 @@ SHELL := env \
|
|||||||
# Tools
|
# Tools
|
||||||
#
|
#
|
||||||
|
|
||||||
TOOLS += $(TOOLDIR)/gobin
|
|
||||||
$(TOOLDIR)/gobin:
|
|
||||||
GO111MODULE=off go get -u github.com/myitcv/gobin
|
|
||||||
|
|
||||||
# external tool
|
# external tool
|
||||||
define tool # 1: binary-name, 2: go-import-path
|
define tool # 1: binary-name, 2: go-import-path
|
||||||
TOOLS += $(TOOLDIR)/$(1)
|
TOOLS += $(TOOLDIR)/$(1)
|
||||||
|
|
||||||
$(TOOLDIR)/$(1): $(TOOLDIR)/gobin Makefile
|
$(TOOLDIR)/$(1): Makefile
|
||||||
gobin $(V) "$(2)"
|
GOBIN="$(CURDIR)/$(TOOLDIR)" go install "$(2)"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc))
|
$(eval $(call tool,godoc,golang.org/x/tools/cmd/godoc@latest))
|
||||||
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt))
|
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
|
||||||
$(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports))
|
$(eval $(call tool,goimports,golang.org/x/tools/cmd/goimports@latest))
|
||||||
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54))
|
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54))
|
||||||
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod))
|
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
|
||||||
|
|
||||||
.PHONY: tools
|
.PHONY: tools
|
||||||
tools: $(TOOLS)
|
tools: $(TOOLS)
|
||||||
|
|||||||
Reference in New Issue
Block a user