-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
69 lines (46 loc) · 1.59 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
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
PKG_SRC := github.com/ah8ad3/gateway
.PHONY: all
all: clean deps test build
deps:
@echo "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)"
@go get -u github.com/golang/dep/cmd/dep
@go get -u golang.org/x/lint/golint
@go get -u github.com/DATA-DOG/godog/cmd/godog
@dep ensure -v -vendor-only
build:
@echo "$(OK_COLOR)==> Building... $(NO_COLOR)"
@/bin/sh -c "BUILD_DEFAULT=$(BUILD_DEFAULT) PKG_SRC=$(PKG_SRC) VERSION=$(VERSION) ./build/build.sh"
test: lint format vet
@echo "$(OK_COLOR)==> Running tests$(NO_COLOR)"
@go test -v -cover ./...
test-integration: lint format vet
@echo "$(OK_COLOR)==> Running tests$(NO_COLOR)"
@go test -v -cover -tags=integration ./...
format:
@echo "$(OK_COLOR)==> checking code format with 'gofmt' tool$(NO_COLOR)"
@gofmt -l -s cmd pkg | grep ".*\.go"; if [ "$$?" = "0" ]; then exit 1; fi
vet:
@echo "$(OK_COLOR)==> checking code correctness with 'go vet' tool$(NO_COLOR)"
@go vet ./...
lint:
@echo "$(OK_COLOR)==> checking code style with 'golint' tool$(NO_COLOR)"
@go list ./... | xargs -n 1 golint -set_exit_status
clean:
@echo "$(OK_COLOR)==> Cleaning project$(NO_COLOR)"
@go clean
@rm -rf bin $GOPATH/bin
number:
@echo "$(OK_COLOR)==> checking code numbers$(NO_COLOR)"
@find . -name "*.go" | xargs wc -l
cov:
@echo "$(OK_COLOR)==> Getting test coverage $(NO_COLOR)"
export TEST=1; \
go test ./... -coverprofile=coverage.out -cover; \
go tool cover -html=coverage.out;
codecov:
export TEST=1; \
go test ./... -race -coverprofile=coverage.txt -covermode=atomic