-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
70 lines (56 loc) · 2.71 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
64
65
66
67
68
69
70
################################################################################
# Target: lint #
################################################################################
# Please use golangci-lint with matching version, otherwise you might encounter errors.
# You can download at https://github.com/golangci/golangci-lint/releases/
# Check .github/wortkflows/test.yaml for the version used in GitHub actions.
ifeq ($(GOOS),windows)
GOLANGCI_LINT:=golangci-lint.exe
else
GOLANGCI_LINT:=golangci-lint
endif
.PHONY: lint
lint:
$(GOLANGCI_LINT) run --timeout=20m ./...
################################################################################
# Target: check-linter #
################################################################################
.SILENT: check-linter # Silence output other than the application run
.PHONY: check-linter
check-linter:
$(RUN_BUILD_TOOLS) check-linter
################################################################################
# Target: modtidy #
################################################################################
.PHONY: modtidy
modtidy:
go mod tidy
################################################################################
# Target: gen-proto #
################################################################################
PROTOC ?=protoc
PROTOC_VERSION = 25.4
PROTOBUF_SUITE_VERSION = 25.4
PROTOC_GEN_GO_VERSION = v1.32.0
PROTOC_GEN_GO_GRPC_VERSION = 1.3.0
PROTO_PREFIX:=github.com/diagridio/go-etcd-cron
.PHONY: check-proto-version
check-proto-version: ## Checking the version of proto related tools
@test "$(shell protoc --version)" = "libprotoc $(PROTOC_VERSION)" \
|| { echo "please use protoc $(PROTOC_VERSION) (protobuf $(PROTOBUF_SUITE_VERSION)) to generate proto"; exit 1; }
@test "$(shell protoc-gen-go-grpc --version)" = "protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION)" \
|| { echo "please use protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION) to generate proto"; exit 1; }
@test "$(shell protoc-gen-go --version 2>&1)" = "protoc-gen-go $(PROTOC_GEN_GO_VERSION)" \
|| { echo "please use protoc-gen-go $(PROTOC_GEN_GO_VERSION) to generate proto"; exit 1; }
.PHONY: gen-proto
gen-proto: check-proto-version _gen-proto modtidy
.PHONY: _gen-proto
_gen-proto:
$(PROTOC) --go_out=. \
--go_opt=module=$(PROTO_PREFIX) \
--go-grpc_out=. \
--go-grpc_opt=require_unimplemented_servers=false,module=$(PROTO_PREFIX) \
./proto/api/*.proto \
./proto/stored/*.proto
test:
go test -count 1 -timeout 300s --race ./...