From 2332262e374e775899be91c0686b0dd4935036a2 Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Thu, 7 Nov 2024 13:07:23 -0800 Subject: [PATCH] Remove coveralls integration and generate metadata for Sonarqube (#952) --- .buildkite/pipeline.yml | 25 +++------------------ .buildkite/scripts/coverage.sh | 15 ------------- .buildkite/scripts/coverage_metadata.sh | 11 ++++++++++ README.md | 2 +- build.gradle | 3 +-- docker/buildkite/docker-compose.yaml | 29 ------------------------- 6 files changed, 16 insertions(+), 69 deletions(-) delete mode 100755 .buildkite/scripts/coverage.sh create mode 100755 .buildkite/scripts/coverage_metadata.sh diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index fc1ff14d2..11e825b0c 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -52,7 +52,8 @@ steps: - label: ":java: Unit test with test services" artifact_paths: - - "build/reports/jacoco/test/*.xml" + - "build/reports/jacoco/test/jacocoTestReport.xml" + - "build/reports/metadata.txt" timeout_in_minutes: 30 retry: automatic: @@ -68,6 +69,7 @@ steps: command: - |- ./gradlew --no-daemon test jacocoTestReport + .buildkite/scripts/coverage_metadata.sh build/reports/metadata.txt - docker-compose#v3.0.0: run: unit-test-test-service config: docker/buildkite/docker-compose.yaml @@ -111,24 +113,3 @@ steps: - docker-compose#v3.0.0: run: unit-test-docker-sticky-off config: docker/buildkite/docker-compose.yaml - - - wait - - - label: ":java: Report test coverage" - retry: - automatic: - - exit_status: "*" - limit: 3 - plugins: - - kubernetes: - <<: *kubernetes - podSpec: - <<: *podSpec - containers: - - <<: *commandContainer - command: - - |- - .buildkite/scripts/coverage.sh - - docker-compose#v3.0.0: - run: test-coverage-report - config: docker/buildkite/docker-compose.yaml diff --git a/.buildkite/scripts/coverage.sh b/.buildkite/scripts/coverage.sh deleted file mode 100755 index a0ca7db23..000000000 --- a/.buildkite/scripts/coverage.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -ex - -# download cover files from all the tests -mkdir -p build/reports/jacoco/test -buildkite-agent artifact download "build/reports/jacoco/test/jacocoTestReport.xml" . --step ":java: Unit test with test services" --build "$BUILDKITE_BUILD_ID" - -echo "download complete" - -# report coverage -./gradlew coverallsJacoco - -# cleanup -rm -rf ./build \ No newline at end of file diff --git a/.buildkite/scripts/coverage_metadata.sh b/.buildkite/scripts/coverage_metadata.sh new file mode 100755 index 000000000..15ffb3a5d --- /dev/null +++ b/.buildkite/scripts/coverage_metadata.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -ex +# This script generates coverage metadata for the coverage report. +# Output is used by SonarQube integration in Uber and not used by OS repo coverage tool itself. +# Example output: +# commit-sha: 6953daa563e8e44512bc349c9608484cfd4ec4ff +# timestamp: 2024-03-04T19:29:16Z +output_path="$1" +echo "commit-sha: $(git rev-parse HEAD)" > "$output_path" +echo "timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$output_path" +echo "Coverage metadata written to $output_path" \ No newline at end of file diff --git a/README.md b/README.md index 5ea8f0cc4..918f9cbb2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Java framework for Cadence [![Build Status](https://badge.buildkite.com/0c96b8b74c0921208e898c10a602e2fe9ecb7641c2befee0e7.svg?theme=github&branch=master)](https://buildkite.com/uberopensource/cadence-java-client) [![Javadocs](https://www.javadoc.io/badge/com.uber.cadence/cadence-client.svg)](https://www.javadoc.io/doc/com.uber.cadence/cadence-client) [![Coverage Status](https://coveralls.io/repos/github/uber/cadence-java-client/badge.svg)](https://coveralls.io/github/uber/cadence-java-client) +# Java framework for Cadence [![Build Status](https://badge.buildkite.com/0c96b8b74c0921208e898c10a602e2fe9ecb7641c2befee0e7.svg?theme=github&branch=master)](https://buildkite.com/uberopensource/cadence-java-client) [![Javadocs](https://www.javadoc.io/badge/com.uber.cadence/cadence-client.svg)](https://www.javadoc.io/doc/com.uber.cadence/cadence-client) [![codecov](https://codecov.io/gh/uber/cadence-java-client/graph/badge.svg?token=eVBGf4EmXr)](https://codecov.io/gh/uber/cadence-java-client) [Cadence](https://github.com/uber/cadence) is a distributed, scalable, durable, and highly available orchestration engine we developed at Uber Engineering to execute asynchronous long-running business logic in a scalable and resilient way. diff --git a/build.gradle b/build.gradle index be70f0b93..f274cb3d9 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,6 @@ buildscript { plugins { id "com.github.hierynomus.license" version"0.15.0" - id 'com.github.nbaztec.coveralls-jacoco' version '1.2.15' id 'com.github.sherter.google-java-format' version '0.9' id 'net.ltgt.errorprone' version '1.1.1' id 'java-library' @@ -362,7 +361,7 @@ jacoco { jacocoTestReport { dependsOn test reports { - xml.enabled = true // coveralls plugin depends on xml format report + xml.enabled = true html.enabled = true } diff --git a/docker/buildkite/docker-compose.yaml b/docker/buildkite/docker-compose.yaml index 2854ae0a5..bf0d41381 100644 --- a/docker/buildkite/docker-compose.yaml +++ b/docker/buildkite/docker-compose.yaml @@ -93,32 +93,3 @@ services: - "USE_DOCKER_SERVICE=false" volumes: - "../../:/cadence-java-client" - - test-coverage-report: - build: - context: ../../ - dockerfile: ./docker/buildkite/Dockerfile - command: "./gradlew --no-daemon test" - environment: - - "USER=unittest" - - "USE_DOCKER_SERVICE=false" - - CI - - BUILDKITE - - BUILDKITE_AGENT_ACCESS_TOKEN - - BUILDKITE_JOB_ID - - BUILDKITE_BUILD_ID - - BUILDKITE_BUILD_NUMBER - - BUILDKITE_BRANCH - - BUILDKITE_BUILD_URL - - BUILDKITE_PROJECT_SLUG - - BUILDKITE_COMMIT - - BUILDKITE_PULL_REQUEST - - BUILDKITE_TAG - - BUILDKITE_REPO - - BUILDKITE_BUILD_CREATOR - - BUILDKITE_BUILD_CREATOR_EMAIL - - BUILDKITE_BUILD_CREATOR_TEAMS - - BUILDKITE_PULL_REQUEST_REPO - - COVERALLS_REPO_TOKEN - volumes: - - "../../:/cadence-java-client"