2016-02-21 09:38:53 +00:00
|
|
|
.PHONY: all clean deps fmt vet test docker
|
2015-12-23 14:17:14 +00:00
|
|
|
|
2016-01-18 21:32:19 +00:00
|
|
|
EXECUTABLE ?= drone-github-release
|
|
|
|
IMAGE ?= plugins/$(EXECUTABLE)
|
2015-12-23 14:17:14 +00:00
|
|
|
CI_BUILD_NUMBER ?= 0
|
|
|
|
|
2016-01-18 21:32:19 +00:00
|
|
|
LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')"
|
|
|
|
PACKAGES = $(shell go list ./... | grep -v /vendor/)
|
2015-12-23 14:17:14 +00:00
|
|
|
|
2016-02-21 09:38:53 +00:00
|
|
|
all: deps build test
|
|
|
|
|
2015-12-23 14:17:14 +00:00
|
|
|
clean:
|
|
|
|
go clean -i ./...
|
|
|
|
|
|
|
|
deps:
|
|
|
|
go get -t ./...
|
|
|
|
|
2016-01-18 21:32:19 +00:00
|
|
|
fmt:
|
|
|
|
go fmt $(PACKAGES)
|
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet $(PACKAGES)
|
|
|
|
|
2015-12-23 14:17:14 +00:00
|
|
|
test:
|
2016-01-18 21:32:19 +00:00
|
|
|
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
2015-12-23 14:17:14 +00:00
|
|
|
|
2016-01-18 21:32:19 +00:00
|
|
|
docker:
|
|
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)'
|
|
|
|
docker build --rm -t $(IMAGE) .
|
|
|
|
|
|
|
|
$(EXECUTABLE): $(wildcard *.go)
|
2015-12-23 14:17:14 +00:00
|
|
|
go build -ldflags '-s -w $(LDFLAGS)'
|
|
|
|
|
2016-01-18 21:32:19 +00:00
|
|
|
build: $(EXECUTABLE)
|