-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
40 lines (31 loc) · 1.18 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
APPNAME = abelwatch
VERSION=0.0.2
TESTFLAGS=-v -cover -covermode=atomic -bench=.
TEST_COVERAGE_THRESHOLD=18
build:
go build -tags netgo -ldflags "-w" -o ${APPNAME} .
build-linux:
GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags "-w -s -X main.APP_VERSION=${VERSION}" -v -o ${APPNAME}-linux-amd64 .
build-mac:
GOOS=darwin GOARCH=amd64 go build -tags netgo -ldflags "-w -s -X main.APP_VERSION=${VERSION}" -v -o ${APPNAME}-darwin-amd64 .
build-all: build-mac build-linux
clean:
rm -f ${APPNAME}
rm -f ${APPNAME}-linux-amd64
rm -f ${APPNAME}-darwin-amd64
all: setup
build
install
setup:
go get -u github.com/wadey/gocovmerge
glide install
test:
go test ${TESTFLAGS} -coverprofile=abel.txt github.com/indix/abelwatch/abel
go test ${TESTFLAGS} -coverprofile=main.txt github.com/indix/abelwatch/
test-ci: test
gocovmerge *.txt > coverage.txt
@go tool cover -html=coverage.txt -o coverage.html
@go tool cover -func=coverage.txt | grep "total:" | awk '{print $$3}' | sed -e 's/%//' > cov_total.out
@bash -c 'COVERAGE=$$(cat cov_total.out); \
echo "Current Coverage % is $$COVERAGE, expected is ${TEST_COVERAGE_THRESHOLD}."; \
exit $$(echo $$COVERAGE"<${TEST_COVERAGE_THRESHOLD}" | bc -l)'