chore: add codeclimate code coverage support (#126)

This commit is contained in:
Richard Ramos 2021-11-02 09:55:28 -04:00 committed by GitHub
parent 82ec44fcfa
commit 74fab9e50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View File

@ -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/

View File

@ -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)

4
ci/Jenkinsfile vendored
View File

@ -29,6 +29,10 @@ pipeline {
steps { sh 'make test' }
}
stage('Codeclimate') {
steps { sh 'make codeclimate-coverage' }
}
stage('Build example') {
steps { sh 'make build-example' }
}

BIN
coverage/cc-test-reporter Executable file

Binary file not shown.