diff --git a/.drone.star b/.drone.star index f296b9333f..40117bd723 100644 --- a/.drone.star +++ b/.drone.star @@ -96,6 +96,7 @@ def main(ctx): # ocisIntegrationTests(6, [1, 4]) - this will only run 1st and 4th parts # implemented for: ocisIntegrationTests and s3ngIntegrationTests return [ + coverage(), buildAndPublishDocker(), buildOnly(), testIntegration(), @@ -228,6 +229,46 @@ def buildAndPublishDocker(): ] } +def coverage(): + return { + "kind": "pipeline", + "type": "docker", + "name": "unit-test-coverage", + "platform": { + "os": "linux", + "arch": "amd64", + }, + "trigger":{ + "branch":[ + "master" + ], + "event": { + "include": [ + "pull_request", + ], + }, + }, + "steps": [ + { + "name": "unit-test", + "image": "registry.cern.ch/docker.io/library/golang:1.16", + "commands": [ + "make test", + ], + }, + { + "name": "codacy", + "image": "plugins/codacy:1", + "pull": "always", + "settings": { + "token": { + "from_secret": "codacy_token", + }, + }, + }, + ] + } + def buildOnly(): return { "kind": "pipeline", diff --git a/.gitignore b/.gitignore index b0664b8a45..29c958b4aa 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ vendor-bin/**/composer.lock tests/acceptance/output tmp/ +# drone +.drone.yml diff --git a/Makefile b/Makefile index 60aadda020..8809e5d077 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ build-reva: imports go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva test: off - go test -race $$(go list ./... | grep -v /tests/integration) + go test -coverprofile coverage.out -race $$(go list ./... | grep -v /tests/integration) test-integration: build-ci cd tests/integration && go test -race ./... diff --git a/changelog/unreleased/codacy-coverage.md b/changelog/unreleased/codacy-coverage.md new file mode 100644 index 0000000000..a363c17060 --- /dev/null +++ b/changelog/unreleased/codacy-coverage.md @@ -0,0 +1,5 @@ +Enhancement: Add Codacy unit test coverage + +This PR adds unit test coverage upload to Codacy. + +https://github.com/cs3org/reva/pull/1983 \ No newline at end of file