diff --git a/.travis.yml b/.travis.yml index cf7f895db..8334b927d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,12 @@ go: sudo: false before_install: - - go version | (grep -q 'go1.[56]' || exit 0 && go get -u github.com/golang/lint/golint ) - - go get -u github.com/vbatts/git-validation + - make install.tools install: true script: - - go vet -x ./... + - make .govet - make .golint - - git-validation -run DCO,short-subject,dangling-whitespace -v + - make .gitvalidation diff --git a/Makefile b/Makefile index d8569b167..91efe82e9 100644 --- a/Makefile +++ b/Makefile @@ -15,32 +15,32 @@ DOC_FILES := \ config.md \ config-linux.md \ glossary.md -EPOCH_TEST_COMMIT := 041eb73d2e0391463894c04c8ac938036143eba3 +EPOCH_TEST_COMMIT := 78e6667ae2d67aad100b28ee9580b41b7a24e667 + +default: docs -docs: pdf html .PHONY: docs +docs: output/docs.pdf output/docs.html -pdf: - @mkdir -p output/ && \ +output/docs.pdf: + mkdir -p output/ && \ $(DOCKER) run \ -it \ --rm \ -v $(shell pwd)/:/input/:ro \ -v $(shell pwd)/output/:/output/ \ -u $(shell id -u) \ - vbatts/pandoc -f markdown_github -t latex -o /output/docs.pdf $(patsubst %,/input/%,$(DOC_FILES)) && \ - ls -sh $(shell readlink -f output/docs.pdf) + vbatts/pandoc -f markdown_github -t latex -o /$@ $(patsubst %,/input/%,$(DOC_FILES)) -html: - @mkdir -p output/ && \ +output/docs.html: + mkdir -p output/ && \ $(DOCKER) run \ -it \ --rm \ -v $(shell pwd)/:/input/:ro \ -v $(shell pwd)/output/:/output/ \ -u $(shell id -u) \ - vbatts/pandoc -f markdown_github -t html5 -o /output/docs.html $(patsubst %,/input/%,$(DOC_FILES)) && \ - ls -sh $(shell readlink -f output/docs.html) + vbatts/pandoc -f markdown_github -t html5 -o /$@ $(patsubst %,/input/%,$(DOC_FILES)) HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-) @@ -53,19 +53,42 @@ test: .govet .golint .gitvalidation # `go get golang.org/x/tools/cmd/vet` .govet: + @go tool | grep -qw vet || (echo "ERROR: 'go vet' not found. Consider 'make install.tools' target" && false) go vet -x ./... # `go get github.com/golang/lint/golint` .golint: ifeq ($(call ALLOWED_GO_VERSION,1.5,$(HOST_GOLANG_VERSION)),true) + @which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false) golint ./... endif -# `go get github.com/vbatts/git-validation` +# When this is running in travis, it will only check the travis commit range .gitvalidation: - git-validation -q -run DCO,short-subject -v -range $(EPOCH_TEST_COMMIT)..HEAD + @which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false) + git-validation -q -run DCO,short-subject,dangling-whitespace -v -range $(EPOCH_TEST_COMMIT)..HEAD + +.PHONY: install.tools +install.tools: .install.golint .install.govet .install.gitvalidation + +# golint does not even build for =go1.5, so no need to get it. +.install.govet: +ifeq ($(call ALLOWED_GO_VERSION,1.5,$(HOST_GOLANG_VERSION)),true) + go get golang.org/x/tools/cmd/vet +endif + +.install.gitvalidation: + go get github.com/vbatts/git-validation + +.PHONY: clean clean: rm -rf output/ *~