github.com/szyn/goreleaser@v0.76.1-0.20180517112710-333da09a1297/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/gohugoio/hugo.sh | sh
    13  	curl -sfL https://install.goreleaser.com/github.com/alecthomas/gometalinter.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  	gometalinter --deadline 2m --vendor ./...
    48  	find . -name '*.md' -not -wholename './vendor/*' | xargs prettier -l
    49  .PHONY: lint
    50  
    51  # Run all the tests and code checks
    52  ci: build test lint
    53  .PHONY: ci
    54  
    55  # Build a beta version of goreleaser
    56  build:
    57  	go generate ./...
    58  	go build
    59  .PHONY: build
    60  
    61  # Generate the static documentation
    62  static:
    63  	@hugo --source www
    64  .PHONY: static
    65  
    66  serve:
    67  	@hugo server -w -s www
    68  .PHONY: serve
    69  
    70  # Show to-do items per file.
    71  todo:
    72  	@grep \
    73  		--exclude-dir=vendor \
    74  		--exclude-dir=node_modules \
    75  		--exclude=Makefile \
    76  		--text \
    77  		--color \
    78  		-nRo -E ' TODO:.*|SkipNow' .
    79  .PHONY: todo
    80  
    81  
    82  .DEFAULT_GOAL := build