-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
73 lines (54 loc) · 1.93 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
PROJECT ?= "influx-spout"
BUILT_ON ?= $(shell date --iso-8601)
VERSION ?= $(shell git describe --tags --always --dirty --match=v*)
DOCKER_NAME ?= "$(PROJECT)"
DOCKER_TAG ?= "0.1.$(VERSION)"
DOCKER_IMAGE ?= "$(DOCKER_NAME):$(DOCKER_TAG)"
ifeq ($(GOPATH),)
abort:
$(error Ensure Go 1.9+ is available and the GOPATH env variable is set)
endif
all: deps check-git influx-spout influx-spout-tap
clean:
go clean
rm -f influx-spout-tap
check-git:
@# See these files with:
@# git diff
$(info Checking for a clean git working tree)
@if [ "$(shell git diff-files --quiet --ignore-submodules --; echo $$?)" -ne 0 ]; then \
(echo ERROR: unstaged changes in the working tree >&2; exit 1); \
fi
@# See these files with:
@# git diff --cached
@if [ "$(shell git diff-index --cached --quiet HEAD --ignore-submodules --; echo $$?)" -ne 0 ]; then \
(echo ERROR: Uncommitted changes in the index >&2; exit 1); \
fi
deps:
$(info Checking $(PROJECT) dependencies)
go get -u github.com/golang/dep/cmd/dep
${GOPATH}/bin/dep ensure
@# Check for any untracked files under vendor/* after 'dep ensure'
@if [ "$(shell git status --porcelain 2>/dev/null | grep -q '^?? vendor/'; echo $$?)" -eq 0 ]; then \
(echo ERROR: uncommitted files under vendor/ >&2; exit 1); \
fi
influx-spout:
$(info Building $(PROJECT) version=$(VERSION) builtOn=$(BUILT_ON))
@export CGO_ENABLED=0
# Build a static version of influx-spout
go build -a -tags netgo -installsuffix netgo -v -x -ldflags '-X main.version=$(VERSION) -X main.builtOn=$(BUILT_ON) -w -extldflags "-static"'
@ls -l influx-spout
influx-spout-tap:
go build utils/influx-spout-tap.go
docker: influx-spout
$(info Building the docker image $(DOCKER_IMAGE) with $(PROJECT) $(VERSION))
docker build -t "$(DOCKER_IMAGE)" .
.PHONY: test
test:
./runtests -r small medium large
.PHONY: coverage
coverage:
./runtests -c -r small medium large
.PHONY: benchmark
benchmark:
./runtests -b -r small medium large