diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 417d99be329bdaf65b2efe732d50e667296d58da..a251600596a1dea54899c05f7bae4aaaf0b7e849 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,24 @@ code-vulnerability: - govulncheck ./... needs: [] +unit-tests: + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golang:$GOLANG_VERSION + stage: test + before_script: + - apt update && apt install -y make + script: + - make test + - go tool cover -func=coverage.out + - gocover-cobertura < coverage.out > coverage.xml + artifacts: + expire_in: 1 week + when: always + reports: + junit: report.xml + coverage_report: + coverage_format: cobertura + path: coverage.xml + needs: [] integration-test-kms: image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golang:$GOLANG_VERSION-bookworm diff --git a/Makefile b/Makefile index c552a998190dd0a65d3bf155c7bf673cf9976ffd..3455c933acccfa38766c8d63f0d219a3d5f70b24 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,7 @@ lint-fix: install-tools ./$(TOOLS_DIR)/golangci-lint run --config .golangci.yml --fix | jq test: - go test -v ./ekms/... - go test -v ./quantumlayer/... + go test -coverprofile=coverage.out -v ./ekms/... ./quantumlayer/... build-ekms: pre CGO_ENABLED=0 $(GOBUILD) -o $(BUILD_ARTIFACTS_PATH)/ekms ./ekms/main.go