github.com/ncabatoff/goreleaser@v0.83.4-0.20180825212434-93a0055d0362/Makefile (about) 1 SOURCE_FILES?=./... 2 TEST_PATTERN?=. 3 TEST_OPTIONS?= 4 OS=$(shell uname -s) 5 6 export PATH := ./bin:$(PATH) 7 8 # Install all the build and lint dependencies 9 setup: 10 go get -u golang.org/x/tools/cmd/stringer 11 go get -u golang.org/x/tools/cmd/cover 12 curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh 13 curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh 14 curl -sfL https://install.goreleaser.com/github.com/caarlos0/bandep.sh | sh 15 ifeq ($(OS), Darwin) 16 brew install dep 17 else 18 curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh 19 endif 20 dep ensure -vendor-only 21 echo "make check" > .git/hooks/pre-commit 22 chmod +x .git/hooks/pre-commit 23 .PHONY: setup 24 25 check: 26 bandep --ban github.com/tj/assert 27 .PHONY: check 28 29 # Run all the tests 30 test: 31 go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m 32 .PHONY: test 33 34 # Run all the tests and opens the coverage report 35 cover: test 36 go tool cover -html=coverage.txt 37 .PHONY: cover 38 39 # gofmt and goimports all go files 40 fmt: 41 find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done 42 # find . -name '*.md' -not -wholename './vendor/*' | xargs prettier --write 43 .PHONY: fmt 44 45 # Run all the linters 46 lint: 47 # TODO: fix tests and lll issues 48 ./bin/golangci-lint run --tests=false --enable-all --disable=lll ./... 49 # find . -name '*.md' -not -wholename './vendor/*' | xargs prettier -l 50 .PHONY: lint 51 52 # Run all the tests and code checks 53 ci: build test lint 54 .PHONY: ci 55 56 # Build a beta version of goreleaser 57 build: 58 go generate ./... 59 go build 60 .PHONY: build 61 62 # Generate the static documentation 63 static: 64 @hugo --enableGitInfo --source www 65 .PHONY: static 66 67 favicon: 68 wget -O www/static/avatar.png https://avatars2.githubusercontent.com/u/24697112 69 convert www/static/avatar.png -define icon:auto-resize=64,48,32,16 www/static/favicon.ico 70 convert www/static/avatar.png -resize x120 www/static/apple-touch-icon.png 71 .PHONY: favicon 72 73 serve: 74 @hugo server --enableGitInfo --watch --source www --disableFastRender 75 .PHONY: serve 76 77 # Show to-do items per file. 78 todo: 79 @grep \ 80 --exclude-dir=vendor \ 81 --exclude-dir=node_modules \ 82 --exclude=Makefile \ 83 --text \ 84 --color \ 85 -nRo -E ' TODO:.*|SkipNow' . 86 .PHONY: todo 87 88 89 .DEFAULT_GOAL := build