-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
78 lines (59 loc) · 1.64 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
66
67
68
69
70
71
72
73
74
75
76
77
VERSION := $(shell git describe --tags --always --dirty="-dev")
LDFLAGS := -ldflags='-X "github.com/segmentio/ctlstore/pkg/version.version=$(VERSION)"'
DOCKER_REPO := 528451384384.dkr.ecr.us-west-2.amazonaws.com/ctlstore
Q=
GOTESTFLAGS = -race -count 1
export GO111MODULE?=on
.PHONY: deps
deps:
$Qgo get -d ./...
.PHONY: vendor
vendor:
$Qgo mod vendor
.PHONY: clean
clean:
$Qrm -rf vendor/ && git checkout ./vendor && dep ensure
.PHONY: install
install:
$Qgo install ./pkg/cmd/ctlstore
.PHONY: build
build: deps
$Qgo build -ldflags="-X github.com/segmentio/ctlstore/pkg/version.version=${VERSION} -X github.com/segmentio/ctlstore/pkg/globalstats.version=${VERSION}" -o ./bin/ctlstore ./pkg/cmd/ctlstore
.PHONY: docker
docker:
$Qdocker build --build-arg VERSION=$(VERSION) \
-t $(DOCKER_REPO):$(VERSION) \
.
.PHONY: releasecheck
releasecheck:
$Qexit $(shell git status --short | wc -l)
.PHONY: release-nonmaster
release-nonmaster: docker
$Qdocker push $(DOCKER_REPO):$(VERSION)
.PHONY: release
release: docker
$Qdocker tag $(DOCKER_REPO):$(VERSION) $(DOCKER_REPO):latest
$Qdocker push $(DOCKER_REPO):$(VERSION)
$Qdocker push $(DOCKER_REPO):latest
.PHONY: release-stable
release-stable: docker
$Qdocker tag $(DOCKER_REPO):$(VERSION) $(DOCKER_REPO):stable
$Qdocker push $(DOCKER_REPO):stable
.PHONY: vet
vet:
$Qgo vet ./...
.PHONY: generate
generate:
$Qgo generate ./...
.PHONY: fmtcheck
fmtchk:
$Qexit $(shell gofmt -l . | grep -v '^vendor' | wc -l)
.PHONY: fmtfix
fmtfix:
$Qgofmt -w $(shell find . -iname '*.go' | grep -v vendor)
.PHONY: test
test:
$Qgo test $(GOTESTFLAGS) ./...
.PHONY: bench
bench:
$Qgo test $(GOTESTFLAGS) -bench .