diff --git a/.gitignore b/.gitignore index 2c7a4b1a..0aeddcf7 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ go-waku # Output of the go coverage tool, specifically when used with LiteIDE *.out coverage.html +coverage.json # Dependency directories (remove the comment below to include it) # vendor/ diff --git a/Makefile b/Makefile index 9326c70d..350efd57 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,15 @@ coverage: go test -count 1 -coverprofile=coverage.out ./... go tool cover -html=coverage.out -o=coverage.html +codeclimate-coverage: + CC_TEST_REPORTER_ID=343d0af350b29aaf08d1e5bb4465d0e21df6298a27240acd2434457a9984c74a + GIT_COMMIT=$(git log | grep -m1 -oE '[^ ]+$') + ./coverage/cc-test-reporter before-build;\ + go test -count 1 -coverprofile coverage/cover.out ./...;\ + go test -coverprofile coverage/cover.out -json ./... > coverage/coverage.json + EXIT_CODE=$$?;\ + ./coverage/cc-test-reporter after-build -t cover --exit-code $$EXIT_CODE || echo “Skipping Code Climate coverage upload” + # build a docker image for the fleet docker-image: DOCKER_IMAGE_TAG ?= latest docker-image: DOCKER_IMAGE_NAME ?= statusteam/go-waku:$(DOCKER_IMAGE_TAG) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 4f080d41..cc21f02f 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -29,6 +29,10 @@ pipeline { steps { sh 'make test' } } + stage('Codeclimate') { + steps { sh 'make codeclimate-coverage' } + } + stage('Build example') { steps { sh 'make build-example' } } diff --git a/coverage/cc-test-reporter b/coverage/cc-test-reporter new file mode 100755 index 00000000..28e36611 Binary files /dev/null and b/coverage/cc-test-reporter differ