forked from pseudomuto/pseudocms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (50 loc) · 2.12 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
BOLD = \033[1m
CLEAR = \033[0m
CYAN = \033[36m
OS = $(shell uname -s)
ARCH = $(shell uname -m)
help: ## Display this help
@awk '\
BEGIN {FS = ":.*##"; printf "Usage: make $(CYAN)<target>$(CLEAR)\n"} \
/^[a-z0-9]+([\/]%)?([\/](%-)?[a-z\-0-9%]+)*:.*? ##/ { printf " $(CYAN)%-15s$(CLEAR) %s\n", $$1, $$2 } \
/^##@/ { printf "\n$(BOLD)%s$(CLEAR)\n", substr($$0, 5) }' \
$(MAKEFILE_LIST)
##@: Development
dev/setup: bin/buf ## Setup local dependencies
@go mod tidy
@bin/buf mod update
dev/up: ## Run development server(s)
@go run github.com/mattn/goreman start
db/migrate-%: ENV=$*
db/migrate-%: ## Run database migrations
@go run github.com/gobuffalo/pop/v6/soda create --env $(ENV) 2>/dev/null || true
@go run github.com/gobuffalo/pop/v6/soda migrate --env $(ENV)
db/migration: ## Generate a database migration named $(NAME)
@go run github.com/gobuffalo/pop/v6/soda generate fizz "$(NAME)"
##@: Code Gen and Formatting
generate: bin/buf bin/protoc-gen-go bin/protoc-gen-go-grpc bin/protoc-gen-grpc-gateway bin/protoc-gen-openapiv2## Generate protos files and such
@PATH=./bin buf generate
@go generate ./...
lint: bin/buf ## Lints the code base
@bin/buf lint
format: bin/buf ## Format proto files
@bin/buf format -w
##@: Test
test: ## Run unit tests
@go test -cover ./pkg/...
##@: Binaries
bin/buf: ## Install buf to ./bin
@mkdir -p ./bin
@curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v1.15.1/buf-$(OS)-$(ARCH)" \
-o ./bin/buf && chmod +x ./bin/buf
bin/ctl: ## Build ctl to bin/pseudoctl
@go build -o bin/pseudoctl ./cmd/ctl
bin/protoc-gen-go: ## Install protoc-gen-go
@GOBIN=$(abspath ./bin) go install google.golang.org/protobuf/cmd/protoc-gen-go
bin/protoc-gen-go-grpc: ## Install protoc-gen-go-grpc
@GOBIN=$(abspath ./bin) go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
bin/protoc-gen-grpc-gateway: ## Install protoc-gen-grpc-gateway
@GOBIN=$(abspath ./bin) go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
bin/protoc-gen-openapiv2: ## Install protoc-gen-openapiv2
@GOBIN=$(abspath ./bin) go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2