2016-03-23 20:53:09 +01:00
|
|
|
TEST?=./...
|
2016-07-21 21:10:33 +02:00
|
|
|
NAME?=$(shell basename "${CURDIR}")
|
|
|
|
EXTERNAL_TOOLS=\
|
|
|
|
github.com/mitchellh/gox
|
2016-03-23 20:53:09 +01:00
|
|
|
|
|
|
|
default: test
|
|
|
|
|
2016-07-21 21:10:33 +02:00
|
|
|
# test runs the test suite and vets the code.
|
2016-03-23 20:53:09 +01:00
|
|
|
test: generate
|
2016-07-21 21:10:33 +02:00
|
|
|
@echo "==> Running tests..."
|
|
|
|
@go list $(TEST) \
|
|
|
|
| grep -v "github.com/sethvargo/${NAME}/vendor" \
|
|
|
|
| xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS}
|
2016-03-23 20:53:09 +01:00
|
|
|
|
2016-07-21 21:10:33 +02:00
|
|
|
# testrace runs the race checker
|
|
|
|
testrace: generate
|
|
|
|
@echo "==> Running tests (race)..."
|
|
|
|
@go list $(TEST) \
|
|
|
|
| grep -v "github.com/sethvargo/${NAME}/vendor" \
|
|
|
|
| xargs -n1 go test -timeout=60s -race ${TESTARGS}
|
|
|
|
|
|
|
|
# updatedeps installs all the dependencies needed to run and build.
|
2016-03-23 20:53:09 +01:00
|
|
|
updatedeps:
|
2016-07-21 21:10:33 +02:00
|
|
|
@sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'"
|
2016-03-23 20:53:09 +01:00
|
|
|
|
2016-07-21 21:10:33 +02:00
|
|
|
# generate runs `go generate` to build the dynamically generated source files.
|
2016-03-23 20:53:09 +01:00
|
|
|
generate:
|
2016-07-21 21:10:33 +02:00
|
|
|
@echo "==> Generating..."
|
|
|
|
@find . -type f -name '.DS_Store' -delete
|
|
|
|
@go list ./... \
|
|
|
|
| grep -v "github.com/hashicorp/${NAME}/vendor" \
|
|
|
|
| xargs -n1 go generate
|
|
|
|
|
|
|
|
# bootstrap installs the necessary go tools for development/build.
|
|
|
|
bootstrap:
|
|
|
|
@echo "==> Bootstrapping..."
|
|
|
|
@for t in ${EXTERNAL_TOOLS}; do \
|
|
|
|
echo "--> Installing "$$t"..." ; \
|
|
|
|
go get -u "$$t"; \
|
|
|
|
done
|
2016-03-23 20:53:09 +01:00
|
|
|
|
2016-07-21 21:10:33 +02:00
|
|
|
.PHONY: default test testrace updatedeps generate bootstrap
|