-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (44 loc) · 1.65 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
BUILD_DIR = bin
PACKAGE = $(shell go list -m)
bin/: ; mkdir -p $@
bin/mockgen: | bin/
GOBIN="$(realpath $(dir $@))" go install go.uber.org/mock/[email protected]
bin/golangci-lint: | bin/
GOBIN="$(realpath $(dir $@))" go install github.com/golangci/golangci-lint/cmd/[email protected]
.PHONY: lint
lint: | bin/golangci-lint ## Run code linters
@PATH="$(realpath bin):$$PATH" golangci-lint run
.PHONY: test
test: ## Run unit-tests
@go test ./internal/... -race -v -count=1 ./internal/...
.PHONY: mock
mock: | bin/mockgen ## Generate mocks
@PATH="$(realpath bin):$$PATH" go generate ./...
.PHONY: build_server
build_server: ## Build a binary server
CGO_ENABLED=0 go build -o ${BUILD_DIR}/app ${PACKAGE}/cmd/server
.PHONY: build_client
build_client: ## Build a binary client
CGO_ENABLED=0 go build -o ${BUILD_DIR}/app ${PACKAGE}/cmd/client
.PHONY: startd
startd: ## Compose run detached
docker compose -f ./build/docker-compose.yml up -d --build --remove-orphans
.PHONY: start
start: ## Compose run
docker compose -f ./build/docker-compose.yml up --build --remove-orphans
.PHONY: stop
stop: ## Compose down
docker compose -f ./build/docker-compose.yml down --remove-orphans
.PHONY: log
log: ## Compose logs
docker compose -f ./build/docker-compose.yml logs -f
.PHONY: logserver
logserver: ## Compose server logs
docker compose -f ./build/docker-compose.yml logs -f server
.PHONY: logclient
logclient: ## Compose client logs
docker compose -f ./build/docker-compose.yml logs -f client
.PHONY: help
.DEFAULT_GOAL := help
help:
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'