aboutsummaryrefslogtreecommitdiff
path: root/Makefile.common
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.common')
-rw-r--r--Makefile.common31
1 files changed, 27 insertions, 4 deletions
diff --git a/Makefile.common b/Makefile.common
index 066866e..9320176 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -69,6 +69,15 @@ else
69 GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH) 69 GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)
70endif 70endif
71 71
72GOTEST := $(GO) test
73GOTEST_DIR :=
74ifneq ($(CIRCLE_JOB),)
75ifneq ($(shell which gotestsum),)
76 GOTEST_DIR := test-results
77 GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
78endif
79endif
80
72PROMU_VERSION ?= 0.5.0 81PROMU_VERSION ?= 0.5.0
73PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz 82PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
74 83
@@ -141,15 +150,29 @@ else
141 $(GO) get $(GOOPTS) -t ./... 150 $(GO) get $(GOOPTS) -t ./...
142endif 151endif
143 152
153.PHONY: update-go-deps
154update-go-deps:
155 @echo ">> updating Go dependencies"
156 @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
157 $(GO) get $$m; \
158 done
159 GO111MODULE=$(GO111MODULE) $(GO) mod tidy
160ifneq (,$(wildcard vendor))
161 GO111MODULE=$(GO111MODULE) $(GO) mod vendor
162endif
163
144.PHONY: common-test-short 164.PHONY: common-test-short
145common-test-short: 165common-test-short: $(GOTEST_DIR)
146 @echo ">> running short tests" 166 @echo ">> running short tests"
147 GO111MODULE=$(GO111MODULE) $(GO) test -short $(GOOPTS) $(pkgs) 167 GO111MODULE=$(GO111MODULE) $(GOTEST) -short $(GOOPTS) $(pkgs)
148 168
149.PHONY: common-test 169.PHONY: common-test
150common-test: 170common-test: $(GOTEST_DIR)
151 @echo ">> running all tests" 171 @echo ">> running all tests"
152 GO111MODULE=$(GO111MODULE) $(GO) test $(test-flags) $(GOOPTS) $(pkgs) 172 GO111MODULE=$(GO111MODULE) $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
173
174$(GOTEST_DIR):
175 @mkdir -p $@
153 176
154.PHONY: common-format 177.PHONY: common-format
155common-format: 178common-format: