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

83 lines
2.0 KiB
Makefile
Raw Permalink Normal View History

SOURCE_FILES?=./...
2017-01-02 11:23:28 +01:00
TEST_PATTERN?=.
TEST_OPTIONS?=
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
go get -u github.com/alecthomas/gometalinter
2017-05-29 16:57:17 -03:00
go get -u github.com/golang/dep/cmd/dep
2017-02-07 17:00:46 -02:00
go get -u github.com/pierrre/gotestcover
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/apex/static/cmd/static-docs
2017-12-23 11:45:17 -02:00
go get -u github.com/caarlos0/bandep
2017-03-25 21:00:03 -03:00
dep ensure
gometalinter --install
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:
2017-05-11 00:05:51 -03:00
gotestcover $(TEST_OPTIONS) -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
.PHONY: cover
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:
2017-09-14 21:19:56 -03:00
gometalinter --vendor ./...
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:
@rm -rf dist/goreleaser.github.io
@mkdir -p dist
@git clone https://github.com/goreleaser/goreleaser.github.io.git dist/goreleaser.github.io
@rm -rf dist/goreleaser.github.io/theme
2017-09-10 21:11:37 -03:00
@static-docs \
--in docs \
--out dist/goreleaser.github.io \
2017-09-10 21:11:37 -03:00
--title GoReleaser \
--subtitle "Deliver Go binaries as fast and easily as possible" \
--google UA-106198408-1
.PHONY: static
# Show to-do items per file.
todo:
@grep \
--exclude-dir=vendor \
--exclude-dir=node_modules \
--exclude=Makefile \
--text \
--color \
-nRo -E ' TODO:.*|SkipNow|nolint:.*' .
.PHONY: todo
2017-01-02 11:23:28 +01:00
2017-01-02 13:57:36 -02:00
.DEFAULT_GOAL := build