Skip to content

Commit

Permalink
chore: Change test commands and add junit output
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyno-zeta committed Jul 15, 2023
1 parent 27e565f commit 6a1d600
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
- run: dockerize -wait tcp://localhost:8088 -timeout 5m
- run: dockerize -wait tcp://localhost:8181 -timeout 5m
- run: docker logs keycloak
- run: make test/all/gotestfmt
- run: make test/all
- run: make test/coverage
- run: go install github.com/mattn/goveralls@latest
- env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ _dist/
coverage.html
bundle.tar.gz
*.log
junit.xml
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ HAS_GIT := $(shell command -v git;)
HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;)
HAS_CURL:=$(shell command -v curl;)
HAS_MOCKGEN:=$(shell command -v mockgen;)
HAS_GOTESTFMT:=$(shell command -v gotestfmt;)
HAS_GOTESTSUM:=$(shell command -v gotestsum;)
HAS_FIELDALIGNMENT:=$(shell command -v fieldalignment;)

.DEFAULT_GOAL := code/lint
Expand Down Expand Up @@ -96,11 +96,11 @@ endif

.PHONY: test/all
test/all: setup/dep/install
$(GO) test --tags=unit,integration -v -coverpkg=./pkg/... -covermode=count -coverprofile=c.out.tmp ./pkg/...
gotestsum --junitfile junit.xml --format testname --format-hide-empty-pkg -- --tags=unit,integration -coverpkg=./pkg/... -covermode=count -coverprofile=c.out.tmp ./pkg/...

.PHONY: test/all/gotestfmt
test/all/gotestfmt: setup/dep/install
$(GO) test -json --tags=unit,integration -v -coverpkg=./pkg/... -covermode=count -coverprofile=c.out.tmp ./pkg/... | tee /tmp/gotest.log | gotestfmt
.PHONY: test/all/original
test/all/original: setup/dep/install
$(GO) test --tags=unit,integration -v -coverpkg=./pkg/... -covermode=count -coverprofile=c.out.tmp ./pkg/...

.PHONY: test/unit
test/unit: setup/dep/install
Expand Down Expand Up @@ -184,9 +184,9 @@ ifndef HAS_MOCKGEN
@echo "=> Installing mockgen tool"
go install github.com/golang/mock/mockgen@v1.6.0
endif
ifndef HAS_GOTESTFMT
@echo "=> Installing gotestfmt tool"
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.4.1
ifndef HAS_GOTESTSUM
@echo "=> Installing gotestsum tool"
go install gotest.tools/gotestsum@v1.10.1
endif
ifndef HAS_FIELDALIGNMENT
@echo "=> Installing fieldalignment tool"
Expand Down

0 comments on commit 6a1d600

Please sign in to comment.