-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (40 loc) · 1.17 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
BIN := crawlgo
ARCH := amd64
PKG := github.com/tossmilestone/crawlgo
PACKAGES := $(shell go list ./... | grep -v /vendor/)
# Race detector is only supported on amd64.
RACE := $(shell test $$(go env GOARCH) != "amd64" || (echo "-race"))
GOPATH_BIN := $(shell go env GOPATH)/bin
GOVERAGE := $(GOPATH_BIN)/goverage
GOVERALLS := $(GOPATH_BIN)/goveralls
GOLINT := $(GOPATH_BIN)/golint
VERSION := 1.0.0
SRC_DIRS := cmd pkg
INSTALL := n
.PHONY: setup ci check lint
all: setup install ci
ci: setup build check test coverage
install: INSTALL=y
install: build
build: bin/$(BIN)
setup:
@go get -u golang.org/x/lint/golint
@go get -u github.com/haya14busa/goverage
@go get github.com/mattn/goveralls
bin/$(BIN):
@echo "building $@"
ARCH=$(ARCH) \
VERSION=$(VERSION) \
PKG=$(PKG) \
INSTALL=$(INSTALL) \
./build/build.sh
check: lint
lint:
@test -z "$$($(GOLINT) ./... | grep -v vendor/ | tee /dev/stderr)"
test:
@go test -parallel 8 ${RACE} ${PACKAGES}
coverage:
$(GOVERAGE) -v -covermode=count -coverprofile=coverage.out ${PACKAGES}
ifneq "${COVERALLS_TOKEN}" ""
$(GOVERALLS) -coverprofile=coverage.out -service=circle-ci -repotoken ${COVERALLS_TOKEN}
endif