-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
34 lines (28 loc) · 1.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
PACKAGES ?= $(shell go list ./...|grep -v vendor)
VERSION ?= $(shell git describe)
GITSHA ?= $(shell git rev-parse HEAD)
LDFLAGS ?= -w -s -X main.Version=$(VERSION) -X main.GitSHA=$(GITSHA)
LINUX_PACKAGE ?= mesos-cli-linux-amd64
DARWIN_PACKAGE ?= mesos-cli-darwin-amd64
DOCKER_IMAGE := mesanine/mesos-cli
.PHONY: test release docker deploy
all: test
test:
go $@ -v $(PACKAGES)
go vet $(PACKAGES)
cd filter && go test -test.bench Messages*
release:
if ! [ -d ./release ]; then mkdir ./release ; fi
@GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/$(LINUX_PACKAGE)-$(VERSION)
if [ -h ./release/$(LINUX_PACKAGE) ]; then rm -v ./release/$(LINUX_PACKAGE); fi
cd ./release && ln -sv $(LINUX_PACKAGE)-$(VERSION) $(LINUX_PACKAGE)
@GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/$(DARWIN_PACKAGE)-$(VERSION)
if [ -h ./release/$(DARWIN_PACKAGE) ]; then rm -v ./release/$(DARWIN_PACKAGE); fi
cd ./release && ln -sv $(DARWIN_PACKAGE)-$(VERSION) $(DARWIN_PACKAGE)
docker:
$@ build -t $(DOCKER_IMAGE):$(VERSION) .
$@ tag $(DOCKER_IMAGE):$(VERSION) $(DOCKER_IMAGE):latest
deploy:
docker login -u $$DOCKER_LOGIN -p $$DOCKER_PASSWORD
docker push $(DOCKER_IMAGE):$(VERSION)
docker push $(DOCKER_IMAGE):latest