-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (37 loc) · 1.4 KB
/
Makefile
File metadata and controls
50 lines (37 loc) · 1.4 KB
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
############################# Main targets #############################
ci-build: install openapi
# Install dependencies.
install: grpc-install api-linter-install buf-install
# Run all linters and compile proto files.
openapi: grpc
########################################################################
##### Variables ######
ifndef GOPATH
GOPATH := $(shell go env GOPATH)
endif
PROTO_ROOT := "./proto"
GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)
PATH := $(GOBIN):$(PATH)
COLOR := "\e[1;36m%s\e[0m\n"
##### Compile openapi specification #####
grpc: buf-lint api-linter buf-breaking
##### Plugins & tools #####
grpc-install:
printf $(COLOR) "Install/update gRPC plugins..."
go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
buf-install:
printf $(COLOR) "Install/update buf..."
go install github.com/bufbuild/buf/cmd/buf@latest
api-linter-install:
printf $(COLOR) "Install/update api-linter..."
go install github.com/googleapis/api-linter/cmd/api-linter@latest
##### Linters #####
api-linter:
printf $(COLOR) "Run api-linter..."
api-linter --set-exit-status $(PROTO_IMPORTS) --config $(PROTO_ROOT)/api-linter.yaml $(PROTO_FILES)
buf-lint:
printf $(COLOR) "Run buf linter..."
(cd $(PROTO_ROOT) && buf lint)
buf-breaking:
@printf $(COLOR) "Run buf breaking changes check against master branch..."
@(cd $(PROTO_ROOT) && buf breaking --against '.git#branch=master')