mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-11-16 17:40:39 +00:00
35 lines
700 B
Makefile
35 lines
700 B
Makefile
.PHONY: all clean deps fmt vet test docker
|
|
|
|
EXECUTABLE ?= drone-docker
|
|
IMAGE ?= plugins/$(EXECUTABLE)
|
|
COMMIT ?= $(shell git rev-parse --short HEAD)
|
|
|
|
LDFLAGS = -X "main.buildCommit=$(COMMIT)"
|
|
PACKAGES = $(shell go list ./... | grep -v /vendor/)
|
|
|
|
all: deps build test
|
|
|
|
clean:
|
|
go clean -i ./...
|
|
|
|
deps:
|
|
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)
|