1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/Makefile
Carlos Alexandro Becker 5629759220 fix: using curl
2018-05-29 09:26:32 -03:00

83 lines
1.9 KiB
Makefile

SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
OS=$(shell uname -s)
export PATH := ./bin:$(PATH)
# Install all the build and lint dependencies
setup:
go get -u golang.org/x/tools/cmd/stringer
go get -u golang.org/x/tools/cmd/cover
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
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
dep ensure -vendor-only
echo "make check" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
.PHONY: setup
check:
bandep --ban github.com/tj/assert
.PHONY: check
# 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
# Run all the tests and opens the coverage report
cover: test
go tool cover -html=coverage.txt
.PHONY: cover
# gofmt and goimports all go files
fmt:
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
# Run all the linters
lint:
golangci-lint run --enable-all ./...
find . -name '*.md' -not -wholename './vendor/*' | xargs prettier -l
.PHONY: lint
# Run all the tests and code checks
ci: build test lint
.PHONY: ci
# Build a beta version of goreleaser
build:
go generate ./...
go build
.PHONY: build
# Generate the static documentation
static:
@hugo --source www
.PHONY: static
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 \
-nRo -E ' TODO:.*|SkipNow' .
.PHONY: todo
.DEFAULT_GOAL := build