aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSteve Durrheimer <s.durrheimer@gmail.com>2016-01-24 23:38:06 +0100
committerSteve Durrheimer <s.durrheimer@gmail.com>2016-04-28 22:07:21 +0200
commit158200fd49f8691b085c5ad17835fe1feb1ef665 (patch)
tree996be3e1223170b220e3d59e63be74b3a3f155fb /Makefile
parent7c97b784d63f949253c6b9c3514cf8f7eb2ce760 (diff)
downloadprometheus_node_collector-158200fd49f8691b085c5ad17835fe1feb1ef665.tar.bz2
prometheus_node_collector-158200fd49f8691b085c5ad17835fe1feb1ef665.tar.xz
prometheus_node_collector-158200fd49f8691b085c5ad17835fe1feb1ef665.zip
New release process using docker, circleci and a centralized
building tool
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 43 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 10d7545..ef94cec 100644
--- a/Makefile
+++ b/Makefile
@@ -11,18 +11,50 @@
11# See the License for the specific language governing permissions and 11# See the License for the specific language governing permissions and
12# limitations under the License. 12# limitations under the License.
13 13
14VERSION := 0.12.0rc3 14GO := GO15VENDOREXPERIMENT=1 go
15TARGET := node_exporter 15PROMU := $(GOPATH)/bin/promu
16pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
16 17
17REVISION := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown') 18PREFIX ?= $(shell pwd)
18BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown') 19BIN_DIR ?= $(shell pwd)
20DOCKER_IMAGE_NAME ?= node-exporter
21DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
19 22
20REPO_PATH := "github.com/prometheus/node_exporter"
21LDFLAGS := -X main.Version=$(VERSION)
22LDFLAGS += -X $(REPO_PATH)/collector.Version=$(VERSION)
23LDFLAGS += -X $(REPO_PATH)/collector.Revision=$(REVISION)
24LDFLAGS += -X $(REPO_PATH)/collector.Branch=$(BRANCH)
25 23
26GOFLAGS := -ldflags "$(LDFLAGS)" 24all: format build test
27 25
28include Makefile.COMMON 26style:
27 @echo ">> checking code style"
28 @! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
29
30test:
31 @echo ">> running tests"
32 @$(GO) test -short $(pkgs)
33
34format:
35 @echo ">> formatting code"
36 @$(GO) fmt $(pkgs)
37
38vet:
39 @echo ">> vetting code"
40 @$(GO) vet $(pkgs)
41
42build: promu
43 @echo ">> building binaries"
44 @$(PROMU) build --prefix $(PREFIX)
45
46tarball: promu
47 @echo ">> building release tarball"
48 @$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
49
50docker:
51 @echo ">> building docker image"
52 @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
53
54promu:
55 @GOOS=$(shell uname -s | tr A-Z a-z) \
56 GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \
57 $(GO) get -u github.com/prometheus/promu
58
59
60.PHONY: all style format build test vet tarball docker promu