1# make file to hold the logic of build and test setup 2ZK_VERSION ?= 3.4.12 3 4ZK = zookeeper-$(ZK_VERSION) 5ZK_URL = "https://archive.apache.org/dist/zookeeper/$(ZK)/$(ZK).tar.gz" 6 7PACKAGES := $(shell go list ./... | grep -v examples) 8 9.DEFAULT_GOAL := test 10 11$(ZK): 12 wget $(ZK_URL) 13 tar -zxf $(ZK).tar.gz 14 # we link to a standard directory path so then the tests dont need to find based on version 15 # in the test code. this allows backward compatable testing. 16 ln -s $(ZK) zookeeper 17 18.PHONY: install-covertools 19install-covertools: 20 go get github.com/mattn/goveralls 21 go get golang.org/x/tools/cmd/cover 22 23.PHONY: setup 24setup: $(ZK) install-covertools 25 26.PHONY: lint 27lint: 28 go fmt ./... 29 go vet ./... 30 31.PHONY: build 32build: 33 go build ./... 34 35.PHONY: test 36test: build 37 go test -timeout 500s -v -race -covermode atomic -coverprofile=profile.cov $(PACKAGES) 38 # ignore if we fail to publish coverage 39 -goveralls -coverprofile=profile.cov -service=travis-ci 40