github.com/tahsinrahman/goreleaser@v0.79.1/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  	# TODO: temporary hack for https://github.com/golang/go/issues/21387
    13  	(cd $$GOPATH/src/golang.org/x/tools; git checkout ae8cc594552814363a7aeeb4f2825515a771fa38; go install ./cmd/stringer/... ; go install ./cmd/cover/...)
    14  	curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
    15  	curl -sfL https://install.goreleaser.com/github.com/gohugoio/hugo.sh | sh
    16  	curl -sfL https://install.goreleaser.com/github.com/caarlos0/bandep.sh | sh
    17  ifeq ($(OS), Darwin)
    18  	brew install dep
    19  else
    20  	curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
    21  endif
    22  	dep ensure -vendor-only
    23  	echo "make check" > .git/hooks/pre-commit
    24  	chmod +x .git/hooks/pre-commit
    25  .PHONY: setup
    26  
    27  check:
    28  	bandep --ban github.com/tj/assert
    29  .PHONY: check
    30  
    31  # Run all the tests
    32  test:
    33  	go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
    34  .PHONY: test
    35  
    36  # Run all the tests and opens the coverage report
    37  cover: test
    38  	go tool cover -html=coverage.txt
    39  .PHONY: cover
    40  
    41  # gofmt and goimports all go files
    42  fmt:
    43  	find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
    44  	find . -name '*.md' -not -wholename './vendor/*' | xargs prettier --write
    45  .PHONY: fmt
    46  
    47  # Run all the linters
    48  lint:
    49  	# TODO: fix tests and lll issues
    50  	./bin/golangci-lint run --tests=false --enable-all --disable=lll ./...
    51  	find . -name '*.md' -not -wholename './vendor/*' | xargs prettier -l
    52  .PHONY: lint
    53  
    54  # Run all the tests and code checks
    55  ci: build test lint
    56  .PHONY: ci
    57  
    58  # Build a beta version of goreleaser
    59  build:
    60  	go generate ./...
    61  	go build
    62  .PHONY: build
    63  
    64  # Generate the static documentation
    65  static:
    66  	@hugo --enableGitInfo --source www
    67  .PHONY: static
    68  
    69  favicon:
    70  	wget -O www/static/avatar.png https://avatars2.githubusercontent.com/u/24697112
    71  	convert www/static/avatar.png -define icon:auto-resize=64,48,32,16 www/static/favicon.ico
    72  	convert www/static/avatar.png -resize x120 www/static/apple-touch-icon.png
    73  .PHONY: favicon
    74  
    75  serve:
    76  	@hugo server --enableGitInfo --watch --source www
    77  .PHONY: serve
    78  
    79  # Show to-do items per file.
    80  todo:
    81  	@grep \
    82  		--exclude-dir=vendor \
    83  		--exclude-dir=node_modules \
    84  		--exclude=Makefile \
    85  		--text \
    86  		--color \
    87  		-nRo -E ' TODO:.*|SkipNow' .
    88  .PHONY: todo
    89  
    90  
    91  .DEFAULT_GOAL := build