2017-03-24 17:08:19 -03:00
|
|
|
SOURCE_FILES?=$$(go list ./... | grep -v /vendor/)
|
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-01-15 09:11:37 -02:00
|
|
|
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
|
2017-03-25 21:00:03 -03:00
|
|
|
dep ensure
|
2017-01-15 09:11:37 -02:00
|
|
|
gometalinter --install
|
2017-01-02 11:23:28 +01:00
|
|
|
|
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
|
2017-01-15 09:11:37 -02:00
|
|
|
|
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
|
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
|
2017-01-02 11:23:28 +01:00
|
|
|
|
2017-09-10 17:07:28 -03:00
|
|
|
# Run all the linters
|
|
|
|
lint:
|
2017-01-15 09:11:37 -02:00
|
|
|
gometalinter --vendor --disable-all \
|
2017-01-02 13:57:36 -02:00
|
|
|
--enable=deadcode \
|
|
|
|
--enable=ineffassign \
|
|
|
|
--enable=gosimple \
|
|
|
|
--enable=staticcheck \
|
|
|
|
--enable=gofmt \
|
|
|
|
--enable=goimports \
|
|
|
|
--enable=dupl \
|
|
|
|
--enable=misspell \
|
|
|
|
--enable=errcheck \
|
2017-01-02 14:09:38 -02:00
|
|
|
--enable=vet \
|
|
|
|
--enable=vetshadow \
|
2017-03-22 20:04:58 -03:00
|
|
|
--deadline=10m \
|
2017-01-02 13:57:36 -02:00
|
|
|
./...
|
2017-01-02 11:23:28 +01:00
|
|
|
|
2017-09-10 17:07:28 -03:00
|
|
|
# Run all the tests and code checks
|
|
|
|
ci: test lint
|
2017-01-02 11:23:28 +01:00
|
|
|
|
2017-09-10 17:07:28 -03:00
|
|
|
# Build a beta version of goreleaser
|
|
|
|
build:
|
2017-04-23 13:22:12 +02:00
|
|
|
go build
|
2017-01-02 11:23:28 +01:00
|
|
|
|
2017-09-10 21:11:37 -03:00
|
|
|
HIGHLIGHT=https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0
|
|
|
|
|
2017-09-10 17:07:28 -03:00
|
|
|
# Generate the static documentation
|
|
|
|
static:
|
2017-09-10 21:11:37 -03:00
|
|
|
@static-docs \
|
|
|
|
--in docs \
|
|
|
|
--out ../goreleaser.github.io \
|
|
|
|
--title GoReleaser \
|
|
|
|
--subtitle "Deliver Go binaries as fast and easily as possible" \
|
|
|
|
--google UA-106198408-1 \
|
|
|
|
--script "$(HIGHLIGHT)/highlight.min.js" \
|
|
|
|
--script "$(HIGHLIGHT)/languages/go.min.js" \
|
|
|
|
--script "$(HIGHLIGHT)/languages/yaml.min.js" \
|
2017-09-12 22:43:29 -03:00
|
|
|
--script "$(HIGHLIGHT)/languages/dockerfile.min.js" \
|
2017-09-10 21:11:37 -03:00
|
|
|
--style "$(HIGHLIGHT)/styles/atom-one-dark.min.css" \
|
|
|
|
--inline-script 'hljs.initHighlightingOnLoad();' \
|
|
|
|
--inline-style 'pre { padding: 0; }'
|
|
|
|
|
2017-01-02 11:23:28 +01:00
|
|
|
|
2017-01-02 13:57:36 -02:00
|
|
|
.DEFAULT_GOAL := build
|