-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
59 lines (45 loc) · 1.58 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
$(VERBOSE).SILENT:
############################# Main targets #############################
ci-build: install proto
# Install dependencies.
install: buf-install grpc-install openapiv2-install
# Run all linters and compile proto files.
proto: grpc
########################################################################
##### Variables ######
ifndef GOPATH
GOPATH := $(shell go env GOPATH)
endif
GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)
SHELL := PATH=$(GOBIN):$(PATH) /bin/sh
COLOR := "\e[1;36m%s\e[0m\n"
PROTO_OUT := .gen
$(PROTO_OUT):
mkdir $(PROTO_OUT)
##### Compile proto files for go #####
grpc: buf-lint buf-breaking go-grpc
go-grpc: clean $(PROTO_OUT)
printf $(COLOR) "Compile for go-gRPC..."
buf generate --output $(PROTO_OUT)
##### Plugins & tools #####
buf-install:
printf $(COLOR) "Install/update buf..."
go install github.com/bufbuild/buf/cmd/[email protected]
grpc-install:
printf $(COLOR) "Install/update go and grpc protoc gen ..."
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
openapiv2-install:
printf $(COLOR) "Install/update openapiv2 protoc gen..."
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
##### Linters #####
buf-lint:
printf $(COLOR) "Run buf linter..."
buf lint
buf-breaking:
@printf $(COLOR) "Run buf breaking changes check against main branch..."
buf breaking --against 'https://github.com/temporalio/api-cloud.git#branch=main'
##### Clean #####
clean:
printf $(COLOR) "Delete generated go files..."
rm -rf $(PROTO_OUT)