2018-02-16 23:38:45 +01:00
|
|
|
SOURCE_FILES?=./...
|
|
|
|
TEST_PATTERN?=.
|
|
|
|
TEST_OPTIONS?=
|
2020-07-10 07:40:22 +02:00
|
|
|
TEST_TIMEOUT?=10m
|
2018-02-16 23:38:45 +01:00
|
|
|
|
2018-05-17 02:26:55 +02:00
|
|
|
export PATH := ./bin:$(PATH)
|
2018-10-29 01:36:46 +01:00
|
|
|
export GO111MODULE := on
|
2019-10-09 21:30:17 +02:00
|
|
|
export GOPROXY := https://proxy.golang.org,https://gocenter.io,direct
|
2018-05-17 02:26:55 +02:00
|
|
|
|
2018-02-16 23:38:45 +01:00
|
|
|
# Install all the build and lint dependencies
|
|
|
|
setup:
|
2020-05-13 21:24:06 +02:00
|
|
|
go mod download
|
|
|
|
go generate -v ./...
|
2019-10-11 22:11:28 +02:00
|
|
|
git config core.hooksPath .githooks
|
2018-02-16 23:38:45 +01:00
|
|
|
.PHONY: setup
|
|
|
|
|
2018-02-05 03:54:03 +01:00
|
|
|
|
2018-06-02 20:35:39 +02: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
|
|
|
|
|
2020-07-30 04:12:40 +02:00
|
|
|
acceptance: pull_test_imgs
|
|
|
|
make -e TEST_OPTIONS="-tags=acceptance" test
|
|
|
|
.PHONY: acceptance
|
|
|
|
|
|
|
|
test:
|
2020-08-05 14:48:59 +02:00
|
|
|
go test $(TEST_OPTIONS) -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=$(TEST_TIMEOUT)
|
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
|
2020-05-13 21:24:06 +02:00
|
|
|
golangci-lint run
|
2018-06-02 20:22:21 +02:00
|
|
|
.PHONY: check
|
2018-02-16 23:38:45 +01:00
|
|
|
|
2020-07-30 04:12:40 +02:00
|
|
|
ci: build lint test acceptance
|
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
|
|
|
|
|
2019-10-11 22:11:28 +02:00
|
|
|
deps:
|
|
|
|
go get -u
|
|
|
|
go mod tidy
|
|
|
|
go mod verify
|
|
|
|
.PHONY: deps
|
|
|
|
|
2020-05-24 21:09:47 +02:00
|
|
|
imgs:
|
|
|
|
wget -O www/docs/static/logo.png https://github.com/goreleaser/artwork/raw/master/goreleaserfundo.png
|
|
|
|
wget -O www/docs/static/card.png "https://og.caarlos0.dev/**NFPM**%20|%20A%20simple%20Deb%20and%20RPM%20packager%20written%20in%20Go.png?theme=light&md=1&fontSize=80px&images=https://github.com/goreleaser.png"
|
|
|
|
wget -O www/docs/static/avatar.png https://github.com/goreleaser.png
|
|
|
|
convert www/docs/static/avatar.png -define icon:auto-resize=64,48,32,16 www/docs/static/favicon.ico
|
|
|
|
convert www/docs/static/avatar.png -resize x120 www/docs/static/apple-touch-icon.png
|
|
|
|
.PHONY: imgs
|
|
|
|
|
|
|
|
serve:
|
|
|
|
@docker run --rm -it -p 8000:8000 -v ${PWD}/www:/docs squidfunk/mkdocs-material
|
|
|
|
.PHONY: serve
|
|
|
|
|
2018-02-16 23:38:45 +01:00
|
|
|
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
|