chore(ci): save test log as an artifact

This commit is contained in:
Jay McCure 2023-07-11 16:20:39 +10:00
parent 8aa562b422
commit 4875819ae3
No known key found for this signature in database
3 changed files with 7 additions and 2 deletions

3
.gitignore vendored
View File

@ -57,3 +57,6 @@ log.txt.glab-cli
*.tar
*.tar.gz
*.tar.bz2
# gotestsum test log
test-output.log

View File

@ -128,6 +128,8 @@ run_tests:
- echo -e "\e[0Ksection_end:`date +%s`:coverage\r\e[0K"
coverage: /^total:\t+\(statements\)\t+\d+\.\d+%$/
artifacts:
paths:
- test-output.log
reports:
junit: coverage.xml

View File

@ -118,7 +118,7 @@ TEST_PKGS ?= ./pkg/... ./internal/... ./commands/... ./cmd/...
#
# Finally, there are some integration tests perform actual API calls and require GITLAB_TOKEN (personal access token)
# and GITLAB_TEST_HOST (GitLab instance to test) to be set. If either of these are not set the integration tests
# will be skipped and only the unit tests will be run.
# will fail in CI or will be skipped if not in CI.
test: TEST_FORMAT ?= short
test: SHELL = /bin/bash # set environment variables to ensure consistent test behavior
test: VISUAL=
@ -127,7 +127,7 @@ test: PAGER=
test: export CI_PROJECT_PATH=$(shell git remote get-url origin)
test: export CGO_ENABLED=1
test: bin/gotestsum ## Run tests
$(GOTEST) --no-summary=skipped --junitfile ./coverage.xml --format ${TEST_FORMAT} -- -coverprofile=./coverage.txt -covermode=atomic $(filter-out -v,${GOARGS}) $(if ${TEST_PKGS},${TEST_PKGS},./...)
$(GOTEST) --jsonfile test-output.log --no-summary=skipped --junitfile ./coverage.xml --format ${TEST_FORMAT} -- -coverprofile=./coverage.txt -covermode=atomic $(filter-out -v,${GOARGS}) $(if ${TEST_PKGS},${TEST_PKGS},./...)
.PHONY: test-race
test-race: SHELL = /bin/bash # set environment variables to ensure consistent test behavior