color unit-test output

Signed-off-by: lxtywypc <lxtywypc@gmail.com>
This commit is contained in:
lxtywypc 2023-07-29 22:11:14 +08:00
parent 2a314eb46e
commit ba6e7f6ccf
2 changed files with 19 additions and 4 deletions

View File

@ -80,6 +80,8 @@ jobs:
name: unit test
needs: build
runs-on: ubuntu-22.04
env:
COLOR_GOTEST_ENABLED: enabled
steps:
- name: checkout code
uses: actions/checkout@v3

View File

@ -102,12 +102,25 @@ push-chart:
helm push _output/charts/karmada-chart-${VERSION}.tgz oci://docker.io/karmada
helm push _output/charts/karmada-operator-chart-${VERSION}.tgz oci://docker.io/karmada
COLOR_GOTEST_REGISTRY:=github.com/rakyll/gotest
COLOR_GOTEST_VERSION:=aeb9f1f4739020c60963f21eec2e65672307a9ac
COLOR_GOTEST_ENABLED?=
GOTEST_PALETTE?=hired,higreen
GOTEST=go test
.PHONY: install_gotest
install_gotest:
ifdef COLOR_GOTEST_ENABLED
go install ${COLOR_GOTEST_REGISTRY}@${COLOR_GOTEST_VERSION}
GOTEST=gotest
endif
.PHONY: test
test:
test: install_gotest
mkdir -p ./_output/coverage/
go test --race --v ./pkg/... -coverprofile=./_output/coverage/coverage_pkg.txt -covermode=atomic
go test --race --v ./cmd/... -coverprofile=./_output/coverage/coverage_cmd.txt -covermode=atomic
go test --race --v ./examples/... -coverprofile=./_output/coverage/coverage_examples.txt -covermode=atomic
$(GOTEST) --race --v ./pkg/... -coverprofile=./_output/coverage/coverage_pkg.txt -covermode=atomic
$(GOTEST) --race --v ./cmd/... -coverprofile=./_output/coverage/coverage_cmd.txt -covermode=atomic
$(GOTEST) --race --v ./examples/... -coverprofile=./_output/coverage/coverage_examples.txt -covermode=atomic
upload-images: images
@echo "push images to $(REGISTRY)"