-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
53 lines (41 loc) · 1.3 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
all: lint tests binary ## Runs lint, tests, and builds the binary
PHONY: help all tests coverage lint golint clean binary go-run vendor unit-tests
GOOS=linux
APP_NAME=loadbalancerproviderhaproxy
help: Makefile ## Print help
@grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -e 's/:.*##/#/' | column -c 2 -t -s#
tests: | unit-tests
unit-tests: ## Runs unit tests
@echo --- Running unit tests...
@date -Iseconds
@go test -race -cover -failfast -tags testtools -p 1 -v ./...
coverage: ## Generates coverage report
@echo --- Generating coverage report...
@date -Iseconds
@go test -race -coverprofile=coverage.out -covermode=atomic -tags testtools -p 1 ./...
@go tool cover -func=coverage.out
@go tool cover -html=coverage.out
lint: golint ## Runs linting
golint:
@echo --- Running golint...
@date -Iseconds
@golangci-lint run
clean: ## Clean up all the things
@echo --- Cleaning...
@date -Iseconds
@rm -rf ./bin/
@rm -rf coverage.out
@go clean -testcache
binary: | vendor ## Builds the binary
@echo --- Building binary...
@date -Iseconds
@go build -o bin/${APP_NAME} main.go
vendor: ## Vendors dependencies
@echo --- Downloading dependencies...
@date -Iseconds
@go mod tidy
@go mod download
go-run: ## Runs the app
@echo --- Running binary...
@date -Iseconds
@go run main.go process --debug