2016-02-21 09:38:52 +00:00
|
|
|
.PHONY: all clean deps fmt vet test docker
|
2016-01-18 21:31:56 +00:00
|
|
|
|
|
|
|
EXECUTABLE ?= drone-docker
|
2016-06-18 20:23:15 +00:00
|
|
|
IMAGE ?= plugins/docker
|
2016-02-21 10:06:39 +00:00
|
|
|
COMMIT ?= $(shell git rev-parse --short HEAD)
|
2016-01-18 21:31:56 +00:00
|
|
|
|
2016-02-21 10:06:39 +00:00
|
|
|
LDFLAGS = -X "main.buildCommit=$(COMMIT)"
|
2016-01-18 21:31:56 +00:00
|
|
|
PACKAGES = $(shell go list ./... | grep -v /vendor/)
|
|
|
|
|
2016-02-21 09:38:52 +00:00
|
|
|
all: deps build test
|
|
|
|
|
2016-01-18 21:31:56 +00:00
|
|
|
clean:
|
|
|
|
go clean -i ./...
|
|
|
|
|
|
|
|
deps:
|
2016-06-18 20:23:15 +00:00
|
|
|
go get -u github.com/codegangsta/cli/...
|
2016-01-18 21:31:56 +00:00
|
|
|
go get -t ./...
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
go fmt $(PACKAGES)
|
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet $(PACKAGES)
|
|
|
|
|
|
|
|
test:
|
|
|
|
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
|
|
|
|
|
|
|
docker:
|
|
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)'
|
|
|
|
docker build --rm -t $(IMAGE) .
|
|
|
|
|
|
|
|
$(EXECUTABLE): $(wildcard *.go)
|
|
|
|
go build -ldflags '-s -w $(LDFLAGS)'
|
|
|
|
|
|
|
|
build: $(EXECUTABLE)
|