From b601d635421af062ab324b962a9233f685f09ce1 Mon Sep 17 00:00:00 2001 From: lincmba Date: Tue, 7 Nov 2023 12:43:39 +0300 Subject: [PATCH] Address requested changes: - Add jacoco test coverage reports generation - Only perform spotless check --- .github/workflows/ci.yml | 6 +++--- efsity/README.md | 10 +++++++++- efsity/build.gradle.kts | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 306c3646..fc64a1a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,8 @@ jobs: distribution: 'temurin' java-version: 11 - - name: Run Unit tests - run: ./gradlew test + - name: Run Unit Tests and Generate Coverage Report + run: ./gradlew test jacocoTestReport working-directory: efsity run-spotless-check: @@ -37,5 +37,5 @@ jobs: java-version: 11 - name: Run spotless check - run: ./gradlew spotlessApply + run: ./gradlew spotlessCheck working-directory: efsity diff --git a/efsity/README.md b/efsity/README.md index b9c8d921..30997b54 100644 --- a/efsity/README.md +++ b/efsity/README.md @@ -232,4 +232,12 @@ To run some tests ./gradlew test --test #example ./gradlew test --test com.example.TestClassName.testMethodName -``` \ No newline at end of file +``` + +To run tests and generate a coverage report: + +```console +./gradlew test jacocoTestReport +``` + +A report will be generated at `$buildDir/reports/jacoco/test` \ No newline at end of file diff --git a/efsity/build.gradle.kts b/efsity/build.gradle.kts index b70fde5a..d90e1eb8 100644 --- a/efsity/build.gradle.kts +++ b/efsity/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("maven-publish") alias(deps.plugins.spotless.maven.plugin) alias(deps.plugins.buildConfig.constants.plugin) + id("jacoco") } repositories { @@ -131,3 +132,5 @@ tasks.assemble { } application { mainClass.set("org.smartregister.Main") } + +jacoco { toolVersion = "0.8.7" }