diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45a4982fb..4daf2c55e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/Makefile b/Makefile index 2ae6ff5d0..6ce41eb2d 100644 --- a/Makefile +++ b/Makefile @@ -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)"