File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,12 @@ jobs:
169
169
key : unittest-${{ runner.os }}-${{ matrix.runner }}-go-build-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
170
170
- name : Run Unit Tests
171
171
run : |
172
- make -j4 gotest
172
+ make -j4 gotest-with-junit
173
+ - uses : actions/upload-artifact@v4
174
+ with :
175
+ name : test-results-${{ runner.os }}-${{ matrix.runner }}-${{ matrix.go-version }}
176
+ path : internal/tools/testresults/
177
+ retention-days : 4
173
178
unittest :
174
179
if : always()
175
180
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ gotest-with-cover:
56
56
@$(MAKE ) for-all-target TARGET=" test-with-cover"
57
57
$(GOCMD ) tool covdata textfmt -i=./coverage/unit -o ./coverage.txt
58
58
59
+ .PHONY : gotest-with-junit
60
+ gotest-with-junit :
61
+ @$(MAKE ) for-all-target TARGET=" test-with-junit"
62
+
59
63
.PHONY : gotestifylint-fix
60
64
gotestifylint-fix :
61
65
$(MAKE ) for-all-target TARGET=" testifylint-fix"
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ ALL_PKGS := $(sort $(shell go list ./...))
4
4
# COVER_PKGS is the list of packages to include in the coverage
5
5
COVER_PKGS := $(shell go list ./... | tr "\n" ",")
6
6
7
+ CURR_MOD := $(shell go list -m | tr '/' '-' )
8
+
7
9
GOTEST_TIMEOUT?=240s
8
10
GOTEST_OPT?= -race -timeout $(GOTEST_TIMEOUT)
9
11
GOCMD?= go
@@ -19,6 +21,8 @@ TOOLS_MOD_REGEX := "\s+_\s+\".*\""
19
21
TOOLS_PKG_NAMES := $(shell grep -E $(TOOLS_MOD_REGEX) < $(TOOLS_MOD_DIR)/tools.go | tr -d " _\"" | grep -vE '/v[0-9]+$$')
20
22
TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_PKG_NAMES))))
21
23
CHLOGGEN_CONFIG := .chloggen/config.yaml
24
+ # no trailing slash
25
+ JUNIT_OUT_DIR ?= $(TOOLS_MOD_DIR)/testresults
22
26
23
27
ADDLICENSE := $(TOOLS_BIN_DIR)/addlicense
24
28
APIDIFF := $(TOOLS_BIN_DIR)/apidiff
@@ -56,6 +60,11 @@ test-with-cover: $(GOTESTSUM)
56
60
mkdir -p $(PWD)/coverage/unit
57
61
$(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) -cover -covermode=atomic -coverpkg $(COVER_PKGS) -args -test.gocoverdir="$(PWD)/coverage/unit"
58
62
63
+ .PHONY: test-with-junit
64
+ test-with-junit: $(GOTESTSUM)
65
+ mkdir -p $(JUNIT_OUT_DIR)
66
+ $(GOTESTSUM) --packages="./..." --junitfile $(JUNIT_OUT_DIR)/$(CURR_MOD)-junit.xml -- $(GOTEST_OPT) ./...
67
+
59
68
.PHONY: benchmark
60
69
benchmark: $(GOTESTSUM)
61
70
$(GOTESTSUM) --packages="$(ALL_PKGS)" -- -bench=. -run=notests ./... | tee benchmark.txt
You can’t perform that action at this time.
0 commit comments