1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
goreleaser/Makefile

89 lines
2.2 KiB
Makefile
Raw Normal View History

SOURCE_FILES?=./...
2017-01-02 11:23:28 +01:00
TEST_PATTERN?=.
TEST_OPTIONS?=
OS=$(shell uname -s)
2017-01-02 11:23:28 +01:00
export PATH := ./bin:$(PATH)
2017-09-10 17:07:28 -03:00
# Install all the build and lint dependencies
setup:
2017-12-18 09:19:02 -02:00
go get -u golang.org/x/tools/cmd/stringer
2017-02-07 17:00:46 -02:00
go get -u golang.org/x/tools/cmd/cover
2018-05-29 09:17:17 -03:00
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
2018-05-13 16:06:14 -03:00
curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh
curl -sfL https://install.goreleaser.com/github.com/caarlos0/bandep.sh | sh
ifeq ($(OS), Darwin)
brew install dep
else
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
endif
2018-05-14 09:56:37 -03:00
dep ensure -vendor-only
2017-12-23 11:45:17 -02:00
echo "make check" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
.PHONY: setup
2017-01-02 11:23:28 +01:00
2017-12-23 11:45:17 -02:00
check:
bandep --ban github.com/tj/assert
.PHONY: check
2017-09-10 17:07:28 -03:00
# Run all the tests
test:
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: test
2017-09-10 17:07:28 -03:00
# Run all the tests and opens the coverage report
cover: test
2017-04-21 21:22:11 -03:00
go tool cover -html=coverage.txt
.PHONY: cover
2017-04-14 15:39:32 -03:00
2017-09-10 17:07:28 -03:00
# gofmt and goimports all go files
fmt:
2017-01-30 14:24:32 -02:00
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
find . -name '*.md' -not -wholename './vendor/*' | xargs prettier --write
.PHONY: fmt
2017-01-02 11:23:28 +01:00
2017-09-10 17:07:28 -03:00
# Run all the linters
lint:
golangci-lint run --tests=false --enable-all ./...
find . -name '*.md' -not -wholename './vendor/*' | xargs prettier -l
.PHONY: lint
2017-01-02 11:23:28 +01:00
2017-09-10 17:07:28 -03:00
# Run all the tests and code checks
2017-12-18 09:28:36 -02:00
ci: build test lint
.PHONY: ci
2017-01-02 11:23:28 +01:00
2017-09-10 17:07:28 -03:00
# Build a beta version of goreleaser
build:
2017-12-18 09:19:02 -02:00
go generate ./...
go build
.PHONY: build
2017-09-10 21:11:37 -03:00
2017-09-10 17:07:28 -03:00
# Generate the static documentation
static:
@hugo --source www
.PHONY: static
2018-06-20 00:16:04 -03:00
favicon:
wget -O www/static/avatar.png https://avatars2.githubusercontent.com/u/24697112
convert www/static/avatar.png -define icon:auto-resize=64,48,32,16 www/static/favicon.ico
convert www/static/avatar.png -resize x120 www/static/apple-touch-icon.png
.PHONY: favicon
2018-04-30 20:57:57 -07:00
serve:
@hugo server -w -s www
.PHONY: serve
# Show to-do items per file.
todo:
@grep \
--exclude-dir=vendor \
--exclude-dir=node_modules \
--exclude=Makefile \
--text \
--color \
2018-03-04 20:23:38 -03:00
-nRo -E ' TODO:.*|SkipNow' .
.PHONY: todo
2017-01-02 11:23:28 +01:00
2017-01-02 13:57:36 -02:00
.DEFAULT_GOAL := build