Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ jobs:
key: unittest-${{ runner.os }}-${{ matrix.runner }}-go-build-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
- name: Run Unit Tests
run: |
make -j4 gotest
make -j4 gotest-with-junit
- uses: actions/upload-artifact@v4
with:
name: test-results-${{ runner.os }}-${{ matrix.runner }}-${{ matrix.go-version }}
path: internal/tools/testresults/
retention-days: 4
unittest:
if: always()
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ gotest-with-cover:
@$(MAKE) for-all-target TARGET="test-with-cover"
$(GOCMD) tool covdata textfmt -i=./coverage/unit -o ./coverage.txt

.PHONY: gotest-with-junit
gotest-with-junit:
@$(MAKE) for-all-target TARGET="test-with-junit"

.PHONY: gotestifylint-fix
gotestifylint-fix:
$(MAKE) for-all-target TARGET="testifylint-fix"
Expand Down
9 changes: 9 additions & 0 deletions Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ALL_PKGS := $(sort $(shell go list ./...))
# COVER_PKGS is the list of packages to include in the coverage
COVER_PKGS := $(shell go list ./... | tr "\n" ",")

CURR_MOD := $(shell go list -m | tr '/' '-' )

GOTEST_TIMEOUT?=240s
GOTEST_OPT?= -race -timeout $(GOTEST_TIMEOUT)
GOCMD?= go
Expand All @@ -19,6 +21,8 @@ TOOLS_MOD_REGEX := "\s+_\s+\".*\""
TOOLS_PKG_NAMES := $(shell grep -E $(TOOLS_MOD_REGEX) < $(TOOLS_MOD_DIR)/tools.go | tr -d " _\"" | grep -vE '/v[0-9]+$$')
TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_PKG_NAMES))))
CHLOGGEN_CONFIG := .chloggen/config.yaml
# no trailing slash
JUNIT_OUT_DIR ?= $(TOOLS_MOD_DIR)/testresults

ADDLICENSE := $(TOOLS_BIN_DIR)/addlicense
APIDIFF := $(TOOLS_BIN_DIR)/apidiff
Expand Down Expand Up @@ -56,6 +60,11 @@ test-with-cover: $(GOTESTSUM)
mkdir -p $(PWD)/coverage/unit
$(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) -cover -covermode=atomic -coverpkg $(COVER_PKGS) -args -test.gocoverdir="$(PWD)/coverage/unit"

.PHONY: test-with-junit
test-with-junit: $(GOTESTSUM)
mkdir -p $(JUNIT_OUT_DIR)
$(GOTESTSUM) --packages="./..." --junitfile $(JUNIT_OUT_DIR)/$(CURR_MOD)-junit.xml -- $(GOTEST_OPT) ./...

.PHONY: benchmark
benchmark: $(GOTESTSUM)
$(GOTESTSUM) --packages="$(ALL_PKGS)" -- -bench=. -run=notests ./... | tee benchmark.txt
Expand Down