From ac68585af6539ae6a3df32c4a0ed559a66a4732f Mon Sep 17 00:00:00 2001 From: Frank Lou <107960841+mloufra@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:37:03 -0700 Subject: [PATCH] Code coverage (#104) * issue #28 Signed-off-by: mloufra * Update the lastest coomit Signed-off-by: mloufra * Rename the method and fix the conflict Signed-off-by: mloufra * fix merge conflict Signed-off-by: mloufra * Add code coverage report Signed-off-by: mloufra * Rebase the lastest commit Signed-off-by: mloufra * Add code coverage report Signed-off-by: mloufra * delete --coverage Signed-off-by: mloufra Signed-off-by: mloufra --- .codecov.yml | 9 +++++++++ .github/workflows/build.yml | 4 ++++ README.md | 2 ++ build.gradle | 12 ++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..30e721112 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,9 @@ +coverage: + precision: 2 + round: down + range: "70...90" + status: + project: + default: + target: auto # the required coverage value + threshold: 0.2% # the leniency in hitting the target diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f25b91f66..ea45d409c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,3 +21,7 @@ jobs: - name: Run Gradle Check run: | ./gradlew check + - name: Upload Coverage Report + uses: codecov/codecov-action@v3.1.0 + with: + file: ./build/reports/jacoco/test/jacocoTestReport.xml diff --git a/README.md b/README.md index a66c26466..7764a325c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![codecov](https://codecov.io/gh/opensearch-project/opensearch-sdk-java/branch/main/graph/badge.svg)](https://codecov.io/gh/opensearch-project/opensearch-sdk-java) + # OpenSearch SDK - [Introduction](#introduction) - [Contributing](#contributing) diff --git a/build.gradle b/build.gradle index 4138f0a53..767863bcb 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ plugins { id 'java' id "com.diffplug.spotless" version "6.3.0" apply false + id 'jacoco' } @@ -112,4 +113,15 @@ test { events "passed", "skipped", "failed" exceptionFormat "full" } + jacoco { + classDumpDir = file("$buildDir/jacoco/classpathdumps") + } + finalizedBy jacocoTestReport } + +jacocoTestReport { + dependsOn test + reports { + xml.required = true + } +}