forked from thanos-io/thanos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (53 loc) · 1.93 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
PREFIX ?= $(shell pwd)
FILES ?= $(shell find . -type f -name '*.go' -not -path "./vendor/*")
DOCKER_IMAGE_NAME ?= thanos
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))-$(shell date +%Y-%m-%d)-$(shell git rev-parse --short HEAD)
all: install-tools deps format build
deps:
@echo ">> dep ensure"
@dep ensure
format:
@echo ">> formatting code"
@goimports -w $(FILES)
vet:
@echo ">> vetting code"
@go vet ./...
build:
@echo ">> building binaries"
@promu build --prefix $(PREFIX)
install-tools:
@echo ">> fetching goimports"
@go get -u golang.org/x/tools/cmd/goimports
@echo ">> fetching promu"
@go get -u github.com/prometheus/promu
@echo ">> fetching dep"
@go get -u github.com/golang/dep/cmd/dep
test-deps:
@go install github.com/improbable-eng/thanos/cmd/thanos
@go get -u github.com/prometheus/prometheus/cmd/prometheus
@go get -u github.com/prometheus/alertmanager/cmd/alertmanager
proto:
@go get -u github.com/gogo/protobuf/protoc-gen-gogofast
@./scripts/genproto.sh
test: test-deps
@echo ">> running all tests"
@go test $(shell go list ./... | grep -v /vendor/)
assets:
@echo ">> deleting asset file"
@rm pkg/query/ui/bindata.go || true
@echo ">> writing assets"
@go get -u github.com/jteeuwen/go-bindata/...
@go-bindata $(bindata_flags) -pkg ui -o pkg/query/ui/bindata.go -ignore '(.*\.map|bootstrap\.js|bootstrap-theme\.css|bootstrap\.css)' pkg/query/ui/templates/... pkg/query/ui/static/...
@go fmt ./pkg/query/ui
docker: build
@echo ">> building docker image"
@docker build -t "${DOCKER_IMAGE_NAME}" .
docker-push:
@echo ">> pushing image"
@docker tag "${DOCKER_IMAGE_NAME}" improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
@docker push improbable/"$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
docs:
@go get -u github.com/campoy/embedmd
@go build ./cmd/thanos/...
@scripts/genflagdocs.sh
.PHONY: all install-tools format vet build assets docker docker-push docs deps