Skip to content

Commit d99336e

Browse files
authored
Merge pull request prometheus-community#29 from prometheus-community/makefile_common
Synchronize Makefile.common from prometheus/prometheus
2 parents 1a5679d + 1ffa640 commit d99336e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Makefile.common

+16-4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ else
6969
GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)
7070
endif
7171

72+
GOTEST := $(GO) test
73+
GOTEST_DIR :=
74+
ifneq ($(CIRCLE_JOB),)
75+
ifneq ($(shell which gotestsum),)
76+
GOTEST_DIR := test-results
77+
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
78+
endif
79+
endif
80+
7281
PROMU_VERSION ?= 0.5.0
7382
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
7483

@@ -142,14 +151,17 @@ else
142151
endif
143152

144153
.PHONY: common-test-short
145-
common-test-short:
154+
common-test-short: $(GOTEST_DIR)
146155
@echo ">> running short tests"
147-
GO111MODULE=$(GO111MODULE) $(GO) test -short $(GOOPTS) $(pkgs)
156+
GO111MODULE=$(GO111MODULE) $(GOTEST) -short $(GOOPTS) $(pkgs)
148157

149158
.PHONY: common-test
150-
common-test:
159+
common-test: $(GOTEST_DIR)
151160
@echo ">> running all tests"
152-
GO111MODULE=$(GO111MODULE) $(GO) test $(test-flags) $(GOOPTS) $(pkgs)
161+
GO111MODULE=$(GO111MODULE) $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
162+
163+
$(GOTEST_DIR):
164+
@mkdir -p $@
153165

154166
.PHONY: common-format
155167
common-format:

0 commit comments

Comments
 (0)