-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (59 loc) · 1.88 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
.DEFAULT_GOAL := help
# This points to the repository root directory
repo_root = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
.PHONY: run-server
run-server: ## Run the server passing the arguments
@echo "> Running the server ..."
go run cmd/server/main.go $(ARGS)
.PHONY: run-client
run-client: ## Run the client passing the arguments
@echo "> Running the client ..."
go run cmd/client/main.go $(ARGS)
.PHONY: test
test: ## Run tests with coverage
@echo "> Testing..."
go clean --testcache
go test -v ./... -coverprofile=$(repo_root)/test_coverage.out &&\
echo "total coverage: $$(go tool cover -func=$(repo_root)/test_coverage.out | grep total: | awk '{ print $$3}')"\
.PHONY: stress-test
stress-test: ## Run stress tests
@echo "> Running stress tests..."
cd deploy && \
docker-compose up \
--abort-on-container-exit \
--force-recreate \
--pull always \
--scale client=10
.PHONY: tidy
tidy: ## Clean and format Go code
@echo "> Tidying..."
go mod tidy
go fmt ./...
@echo "> Done!"
.PHONY: fmt
fmt: ## Format Go code
go fmt ./...
.PHONY: lint-host
lint-host: ## Run golangci-lint directly on host
@echo "> Linting..."
golangci-lint run -c .golangci.yml -v
@echo "> Done!"
.PHONY: start
start: ## Run the server and client
@echo "> Running the server and client ..."
cd deploy && \
docker-compose up \
--abort-on-container-exit \
--force-recreate \
--pull always
.PHONY: help
help: ## Show this help
@echo "make run-server - Run the server passing the arguments"
@echo "make run-client - Run the client passing the arguments"
@echo "make start - Run the server and client using docker-compose"
@echo "make test - Run tests"
@echo "make stress-test - Run stress tests"
@echo "make tidy - Clean and format Go code"
@echo "make fmt - Format Go code"
@echo "make lint-host - Run golangci-lint directly on host"
@echo "make help - Show this help"