You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
994 B

app := gpm
PKGS := $(shell go list ./... | grep -v vendor)
OUTDIR := .bin
BINARY := $(OUTDIR)/$(app)
GOBIN := $(GOPATH)/bin
LINTBIN := $(GOBIN)/golangci-lint
clean_list = $(OUTDIR)
.PHONY: build clean dev test publish lint
default: lint test build dev
$(OUTDIR):
@mkdir .bin
$(BINARY): ./main.go $(OUTDIR)
go build -o $@ $<
dev: clean $(BINARY)
GPM_DEBUG=true $(BINARY) install
build: $(BINARY)
clean: $(clean_list)
rm -rf $<
$(LINTBIN):
@GO111MODULE=off go get github.com/golangci/golangci-lint/cmd/golangci-lint
lint: $(LINTBIN)
go mod tidy -v
$(LINTBIN) run -p bugs -p format -p performance -p unused
test: lint
go test -v -cover $(PKGS)
publish: $(BINARY)
docker build -t liveauctioneers/$(app):$${VERSION} \
--build-arg version=$${VERSION} \
--build-arg commit=$${COMMIT_SHA:-$${CIRCLE_SHA1}} \
--build-arg initiator=$${INITIATOR:-$${CIRCLE_USERNAME}} \
--build-arg created=$${CREATED_TS:-$$(date +%s)} .
docker push liveauctioneers/$(app):$${VERSION}