-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
65 lines (53 loc) · 1.69 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# setting some defaults if those variables are empty
OWNER=vevo
APP_NAME=awsRetagger
IMAGE_NAME=$(OWNER)/$(APP_NAME)
GO_REVISION?=$(shell git rev-parse HEAD)
GO_TO_REVISION?=$(GO_REVISION)
GO_FROM_REVISION?=$(shell git rev-parse refs/remotes/origin/master)
GIT_TAG=$(IMAGE_NAME):$(GO_REVISION)
BUILD_VERSION?=$(shell date +%Y%m%d%H%M%S)-dev
BUILD_TAG=$(IMAGE_NAME):$(BUILD_VERSION)
LATEST_TAG=$(IMAGE_NAME):latest
PHONY: go-build
docker-lint:
docker run -it --rm -v "${PWD}/Dockerfile":/Dockerfile:ro redcoolbeans/dockerlint
docker-login:
@docker login -u "$(DOCKER_USER)" -p "$(DOCKER_PASS)"
go-dep:
@if [ -f "glide.yaml" ] ; then \
go get github.com/Masterminds/glide \
&& go install github.com/Masterminds/glide \
&& glide install --strip-vendor; \
elif [ -f "Godeps/Godeps.json" ] ; then \
go get github.com/tools/godep \
&& godep restore; \
else \
go get -d -t -v ./...; \
fi
GOFILES_NOVENDOR=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
go-fmt:
@[ $$(gofmt -l $(GOFILES_NOVENDOR) | wc -l) -gt 0 ] && echo "Code differs from gofmt's style" && exit 1 || true
go-lint: go-fmt
@go get -u golang.org/x/lint/golint; \
if [ -f "glide.yaml" ] ; then \
golint -set_exit_status $$(glide novendor); \
go vet -v $$(glide novendor); \
else \
golint -set_exit_status ./...; \
go vet -v ./...; \
fi
go-test:
@if [ -f "glide.yaml" ] ; then \
go test $$(glide novendor); \
else \
go test -v ./...; \
fi
go-build: go-dep go-lint go-test
@go build -v -a -ldflags "-X main.version=$(BUILD_VERSION)"
build: go-build
release:
git tag -s $(BUILD_VERSION) -m "Release $(BUILD_VERSION)"
# We skip publish for now for sanity purposes
goreleaser release --rm-dist
# vim: ft=make