1
1
mirror of https://github.com/goreleaser/nfpm synced 2024-10-01 14:51:15 +02:00
nfpm/Makefile

65 lines
1.5 KiB
Makefile
Raw Normal View History

2018-02-16 23:38:45 +01:00
SOURCE_FILES?=./...
TEST_PATTERN?=.
TEST_OPTIONS?=
2018-06-02 20:22:21 +02:00
OS=$(shell uname -s)
2018-02-16 23:38:45 +01:00
2018-05-17 02:26:55 +02:00
export PATH := ./bin:$(PATH)
2018-02-16 23:38:45 +01:00
# Install all the build and lint dependencies
setup:
2018-05-17 02:26:55 +02:00
curl -sfL https://install.goreleaser.com/github.com/caarlos0/bandep.sh | sh
2018-06-02 20:22:21 +02:00
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
2018-03-11 19:44:39 +01:00
ifeq ($(OS), Darwin)
brew install dep
else
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
endif
2018-06-02 20:22:21 +02:00
dep ensure -vendor-only
2018-02-16 23:38:45 +01:00
echo "make check" > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
.PHONY: setup
2018-02-05 03:54:03 +01:00
check:
2018-02-16 23:38:45 +01:00
bandep --ban github.com/tj/assert
.PHONY: check
2018-02-05 03:54:03 +01:00
pull_test_imgs:
grep FROM ./acceptance/testdata/*.dockerfile | cut -f2 -d' ' | sort | uniq | while read -r img; do docker pull "$$img"; done
.PHONY: pull_test_imgs
test: pull_test_imgs
2018-06-04 13:48:41 +02:00
go test $(TEST_OPTIONS) -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.out $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=5m
2018-06-02 20:22:21 +02:00
.PHONY: test
2018-02-16 23:38:45 +01:00
cover: test
2018-06-02 20:22:21 +02:00
go tool cover -html=coverage.out
2018-02-16 23:38:45 +01:00
.PHONY: cover
fmt:
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
.PHONY: fmt
2018-06-02 20:22:21 +02:00
lint: check
golangci-lint run --enable-all ./...
.PHONY: check
2018-02-16 23:38:45 +01:00
2018-06-02 20:22:21 +02:00
ci: build lint test
2018-02-16 23:38:45 +01:00
.PHONY: ci
build:
2018-06-02 20:22:21 +02:00
go build -o nfpm ./cmd/nfpm/main.go
2018-02-16 23:38:45 +01:00
.PHONY: build
todo:
@grep \
--exclude-dir=vendor \
--exclude-dir=node_modules \
2018-06-02 20:22:21 +02:00
--exclude-dir=bin \
2018-02-16 23:38:45 +01:00
--exclude=Makefile \
--text \
--color \
2018-03-11 19:44:39 +01:00
-nRo -E ' TODO:.*|SkipNow' .
2018-02-16 23:38:45 +01:00
.PHONY: todo
.DEFAULT_GOAL := build