Update build (#1010)

* Update from upstream `Makefile.common`.
* Update CircleCI with simplifed upstream templating.
* Cleanup `Makefile`.

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2018-07-23 09:38:39 +02:00 committed by GitHub
commit 981de58fad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 59 deletions

View file

@ -70,14 +70,17 @@ $(eval $(call goarch_pair,mips64el,mipsel))
all: style vet staticcheck checkmetrics build test $(cross-test) $(test-e2e)
.PHONY: test
test: collector/fixtures/sys/.unpacked
@echo ">> running tests"
$(GO) test -short $(test-flags) $(pkgs)
.PHONY: test-32bit
test-32bit: collector/fixtures/sys/.unpacked
@echo ">> running tests in 32-bit mode"
@env GOARCH=$(GOARCH_CROSS) $(GO) test $(pkgs)
.PHONY: skip-test-32bit
skip-test-32bit:
@echo ">> SKIP running tests in 32-bit mode: not supported on $(OS_detected)/$(GOARCH)"
@ -87,17 +90,21 @@ collector/fixtures/sys/.unpacked: collector/fixtures/sys.ttar
./ttar -C collector/fixtures -x -f collector/fixtures/sys.ttar
touch $@
.PHONY: test-e2e
test-e2e: build collector/fixtures/sys/.unpacked
@echo ">> running end-to-end tests"
./end-to-end-test.sh
.PHONY: skip-test-e2e
skip-test-e2e:
@echo ">> SKIP running end-to-end tests on $(OS_detected)"
.PHONY: checkmetrics
checkmetrics: $(PROMTOOL)
@echo ">> checking metrics for correctness"
./checkmetrics.sh $(PROMTOOL) $(e2e-out)
.PHONY: docker
docker:
ifeq ($(MACH), ppc64le)
$(eval DOCKERFILE=Dockerfile.ppc64le)
@ -105,17 +112,11 @@ endif
@echo ">> building docker image from $(DOCKERFILE)"
@docker build --file $(DOCKERFILE) -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" .
.PHONY: test-docker
test-docker:
@echo ">> testing docker image"
./test_image.sh "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" 9100
.PHONY: promtool $(FIRST_GOPATH)/bin/promtool
$(FIRST_GOPATH)/bin/promtool promtool:
@GOOS= GOARCH= $(GO) get -u github.com/prometheus/prometheus/cmd/promtool
.PHONY: test-e2e promtool checkmetrics
# Declaring the binaries at their default locations as PHONY targets is a hack
# to ensure the latest version is downloaded on every make execution.
# If this is not desired, copy/symlink these binaries to a different path and
# set the respective environment variables.
.PHONY: $(FIRST_GOPATH)/bin/promtool