-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (46 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
BUF_VERSION := "1.27.2"
BUF_BIN := "/usr/local/bin"
.PHONY: dev
dev:
@docker compose down
@make -s deps
@docker compose up
.PHONY: install
install:
@printf "Installing buf...\n"
# This works without `sudo` in Docker. If you want to run it locally, you probably will have to prefix each line with `sudo`.
@rm -rf ${BUF_BIN}/buf && \
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-$$(uname -s)-$$(uname -m)" -o "${BUF_BIN}/buf" && \
chmod +x "${BUF_BIN}/buf"
@printf "\nInstalling compile daemon...\n"
@go install -mod=readonly github.com/githubnemo/[email protected]
@printf "\nInstalling sqlboiler...\n"
@go install -mod=readonly github.com/volatiletech/sqlboiler/[email protected]
@go install -mod=readonly github.com/volatiletech/sqlboiler/v4/drivers/[email protected]
@printf "\nInstalling gowrap...\n"
@go install -mod=readonly github.com/hexdigest/gowrap/cmd/[email protected]
@printf "\nInstalling mockgen...\n"
@go install -mod=readonly go.uber.org/mock/mockgen@latest
.PHONY: deps
deps:
@printf "Refreshing Go modules...\n"
@go mod tidy && go mod vendor
.PHONY: generate
generate:
@printf "Generating protos...\n"
@buf generate --template gen/buf.gen.yaml
@printf "Generating db models...\n"
@sqlboiler --config db/sqlboiler.toml psql
@printf "go generate...\n"
@go generate ./...
@make -s deps
GRPC_BINARY := "bin/grpc"
.PHONY: start-grpc
start-grpc:
@CompileDaemon \
-build="go build -o ${GRPC_BINARY} cmd/grpc/main.go" \
-command="./${GRPC_BINARY}" \
-log-prefix=false \
-graceful-kill=true \
-color=true \
-polling