-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
78 lines (63 loc) · 2.04 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
71
72
73
74
75
76
77
78
.DEFAULT_GOAL := build
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY:help
confirm:
@echo -n 'Are you sure? [y/N] ' && read ans && [ $${ans:-N} = y ]
.PHONY:confirm
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
## run: Runs the server
run:
@go run ./cmd/server
.PHONY:run
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## test: run all tests
.PHONY: test
test: test
@echo 'Removing test cache...'
go clean -testcache
@echo 'Running tests...'
go test -race -vet=off -timeout 10s ./...
## audit: tidy and vendor dependencies and format, vet and test all code
.PHONY: audit
audit: vendor
@echo 'Formatting code...'
go fmt ./...
@echo 'Linting code...'
golangci-lint run
@echo 'Running tests...'
go test -race -vet=off ./...
## vendor: tidy and vendor dependencies
vendor:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Vendoring dependencies...'
go mod vendor
.PHONY:vendor
# ==================================================================================== #
# BUILD
# ==================================================================================== #
#
## build/server: build cmd/server
build/server:
@echo 'Compiling server...'
go build -o=./bin/pulse-server ./cmd/server
.PHONY:build/server
## build/client: build cmd/client
build/client:
@echo 'Compiling client...'
go build -o=./bin/pulse-client ./cmd/client
.PHONY:build/client
## build: builds the server and client applications
build: audit build/server build/client
.PHONY:build