forked from wundergraph/graphql-go-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
63 lines (48 loc) · 1.55 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
GOLANG_CI_VERSION = "v1.51.1"
GOLANG_CI_VERSION_SHORT = "1.51.1"
HAS_GOLANG_CI_LINT := $(shell command -v /tmp/ci/golangci-lint;)
INSTALLED_VERSION := $(shell command -v /tmp/ci/golangci-lint version;)
HAS_CORRECT_VERSION := $(shell command -v if [[ $(INSTALLED_VERSION) == *$(GOLANG_CI_VERSION_SHORT)* ]]; echo "OK" fi)
.PHONY: bootstrap
.PHONY: test
test:
go test --short -count=1 ./...
.PHONY: test-full
test-full:
go test -count=1 ./...
# updateTestFixtures will update all! golden fixtures
.PHONY: updateTestFixtures
updateTestFixtures:
go test ./pkg/... -update
.PHONY: lint
lint:
/tmp/ci/golangci-lint run
.PHONY: format
format:
go fmt ./...
.PHONY: prepare-merge
prepare-merge: format test lint
.PHONY: ci
ci: bootstrap test lint
.PHONY: ci-full
ci-full: bootstrap test-full lint
.PHONY: generate
generate: $(GOPATH)/bin/go-enum $(GOPATH)/bin/mockgen $(GOPATH)/bin/stringer
go generate ./...
go mod tidy
$(GOPATH)/bin/go-enum:
go get -u github.com/abice/go-enum
go install github.com/abice/go-enum
$(GOPATH)/bin/mockgen:
go get -u github.com/golang/mock/gomock
go install github.com/golang/mock/mockgen
$(GOPATH)/bin/stringer:
go get -u -a golang.org/x/tools/cmd/stringer
go install golang.org/x/tools/cmd/stringer
bootstrap:
ifndef HAS_GOLANG_CI_LINT
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /tmp/ci ${GOLANG_CI_VERSION}
endif
updateci:
rm /tmp/ci/golangci-lint
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /tmp/ci ${GOLANG_CI_VERSION}