2018-03-12 22:57:10 +00:00
|
|
|
GIT_TAG?= $(shell git describe --always --tags)
|
|
|
|
BIN = gas
|
|
|
|
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
|
|
|
IMAGE_REPO = docker.io
|
|
|
|
|
|
|
|
default:
|
|
|
|
$(MAKE) bootstrap
|
|
|
|
$(MAKE) build
|
|
|
|
|
2018-04-27 13:45:29 +01:00
|
|
|
bootstrap:
|
|
|
|
dep ensure
|
|
|
|
|
2018-03-12 22:57:10 +00:00
|
|
|
test: bootstrap
|
|
|
|
test -z '$(FMT_CMD)'
|
|
|
|
go vet $(go list ./... | grep -v /vendor/)
|
|
|
|
golint -set_exit_status $(shell go list ./... | grep -v vendor)
|
|
|
|
gas ./...
|
|
|
|
ginkgo -r -v
|
2018-04-27 13:45:29 +01:00
|
|
|
|
2018-03-12 22:57:10 +00:00
|
|
|
build:
|
|
|
|
go build -o $(BIN) ./cmd/gas/
|
2018-04-27 13:45:29 +01:00
|
|
|
|
2018-03-12 22:57:10 +00:00
|
|
|
clean:
|
2018-04-27 13:39:57 +01:00
|
|
|
rm -rf build vendor dist
|
2018-03-12 22:57:10 +00:00
|
|
|
rm -f release image bootstrap $(BIN)
|
2018-04-27 13:45:29 +01:00
|
|
|
|
2018-03-12 22:57:10 +00:00
|
|
|
release: bootstrap
|
2018-04-27 13:45:29 +01:00
|
|
|
@echo "Releasing the gas binary..."
|
|
|
|
goreleaser release
|
2018-03-12 22:57:10 +00:00
|
|
|
|
|
|
|
image: release
|
|
|
|
@echo "Building the Docker image..."
|
2018-04-27 13:39:57 +01:00
|
|
|
docker build -t $(IMAGE_REPO)/$(BIN):$(GIT_TAG) .
|
|
|
|
docker tag $(IMAGE_REPO)/$(BIN):$(GIT_TAG) $(IMAGE_REPO)/$(BIN):latest
|
2018-03-12 22:57:10 +00:00
|
|
|
touch image
|
|
|
|
|
|
|
|
image-push: image
|
|
|
|
@echo "Pushing the Docker image..."
|
2018-04-27 13:39:57 +01:00
|
|
|
docker push $(IMAGE_REPO)/$(BIN):$(GIT_TAG)
|
2018-03-12 22:57:10 +00:00
|
|
|
docker push $(IMAGE_REPO)/$(BIN):latest
|
|
|
|
|
2018-04-27 13:39:57 +01:00
|
|
|
.PHONY: test build clean release image image-push
|
2018-03-12 22:57:10 +00:00
|
|
|
|