github.com/droot/goreleaser@v0.66.2-0.20180420030140-c2db5fb17157/Makefile (about) 1 SOURCE_FILES?=./... 2 TEST_PATTERN?=. 3 TEST_OPTIONS?= 4 OS=$(shell uname -s) 5 6 # Install all the build and lint dependencies 7 setup: 8 go get -u golang.org/x/tools/cmd/stringer 9 go get -u golang.org/x/tools/cmd/cover 10 go get -u github.com/caarlos0/static/cmd/static-docs 11 go get -u github.com/caarlos0/bandep 12 go get -u gopkg.in/alecthomas/gometalinter.v2 13 ifeq ($(OS), Darwin) 14 brew install dep 15 else 16 curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh 17 endif 18 dep ensure 19 gometalinter.v2 --install 20 echo "make check" > .git/hooks/pre-commit 21 chmod +x .git/hooks/pre-commit 22 .PHONY: setup 23 24 check: 25 bandep --ban github.com/tj/assert 26 .PHONY: check 27 28 # Run all the tests 29 test: 30 go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m 31 .PHONY: cover 32 33 # Run all the tests and opens the coverage report 34 cover: test 35 go tool cover -html=coverage.txt 36 .PHONY: cover 37 38 # gofmt and goimports all go files 39 fmt: 40 find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done 41 find . -name '*.md' -not -wholename './vendor/*' | xargs prettier --write 42 .PHONY: fmt 43 44 # Run all the linters 45 lint: 46 gometalinter.v2 --vendor ./... 47 find . -name '*.md' -not -wholename './vendor/*' | xargs prettier -l 48 .PHONY: lint 49 50 # Run all the tests and code checks 51 ci: build test lint 52 .PHONY: ci 53 54 # Build a beta version of goreleaser 55 build: 56 go generate ./... 57 go build 58 .PHONY: build 59 60 # Generate the static documentation 61 static: 62 @rm -rf dist/goreleaser.github.io 63 @mkdir -p dist 64 @git clone https://github.com/goreleaser/goreleaser.github.io.git dist/goreleaser.github.io 65 @rm -rf dist/goreleaser.github.io/theme 66 @static-docs \ 67 --syntax dracula \ 68 --in docs \ 69 --out dist/goreleaser.github.io \ 70 --title GoReleaser \ 71 --subtitle "Deliver Go binaries as fast and easily as possible" \ 72 --google UA-106198408-1 73 .PHONY: static 74 75 # Show to-do items per file. 76 todo: 77 @grep \ 78 --exclude-dir=vendor \ 79 --exclude-dir=node_modules \ 80 --exclude=Makefile \ 81 --text \ 82 --color \ 83 -nRo -E ' TODO:.*|SkipNow' . 84 .PHONY: todo 85 86 87 .DEFAULT_GOAL := build