From a856e0babc3bbb82a814f16518d23f5c6dfd12a6 Mon Sep 17 00:00:00 2001 From: Allain Magyar Date: Fri, 16 Feb 2024 00:42:34 -0300 Subject: [PATCH] test: change coverage to jacoco and add coveralls --- .../{pull-request.yml => build-and-test.yml} | 32 ++++-------- atala-prism-sdk/build.gradle.kts | 50 +++++++++++++------ 2 files changed, 45 insertions(+), 37 deletions(-) rename .github/workflows/{pull-request.yml => build-and-test.yml} (58%) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/build-and-test.yml similarity index 58% rename from .github/workflows/pull-request.yml rename to .github/workflows/build-and-test.yml index 59f20b532..c47f7884e 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/build-and-test.yml @@ -42,24 +42,14 @@ jobs: run: echo ${{ runner.os }} - name: Build for JS, Android, JVM - run: | - ./gradlew build test koverXmlReport koverHtmlReport --stacktrace + run: ./gradlew build allTests koverXmlReportRelease koverHtmlReportRelease --stacktrace - - name: Coverage Report - uses: mi-kas/kover-report@v1 + - name: Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + uses: coverallsapp/github-action@v2 with: - path: ${{ github.workspace }}/atala-prism-sdk/build/reports/kover/report.xml - token: ${{ env.ATALA_GITHUB_TOKEN }} - title: Code Coverage - update-comment: true - -# - name: Publish test results -# if: always() -# uses: EnricoMi/publish-unit-test-result-action@v2 -# with: -# files: "${{ github.workspace }}/atala-prism-sdk/build/test-results/testReleaseUnitTest/TEST-*.xml" -# comment_title: "Unit Test Results" -# check_name: "Unit Test Results" + file: "${{ github.workspace }}/atala-prism-sdk/build/reports/android/result.xml" - name: Publish test results if: always() @@ -70,13 +60,11 @@ jobs: check_name: "Unit Test Results" - name: Upload Tests Reports - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: - name: kover-html + name: coverage-results path: | - atala-prism-sdk/build/kover/atala-prism-sdk/xml - atala-prism-sdk/build/reports/tests/**/*.html - atala-prism-sdk/build/reports/tests/jvmTest/index.html - + atala-prism-sdk/build/reports/jvm + atala-prism-sdk/build/reports/android if-no-files-found: error diff --git a/atala-prism-sdk/build.gradle.kts b/atala-prism-sdk/build.gradle.kts index 161e04791..ae6bf07e2 100644 --- a/atala-prism-sdk/build.gradle.kts +++ b/atala-prism-sdk/build.gradle.kts @@ -17,23 +17,42 @@ plugins { id("org.jetbrains.kotlinx.kover") version "0.7.3" } +kover { + useJacoco("0.8.11") + excludeJavaCode() + excludeInstrumentation { + packages("androidx.test.espresso", "androidx.test.ext") + } +} + koverReport { + filters { + excludes { + packages( + "io.iohk.atala.prism.protos", + "io.iohk.atala.prism.walletsdk.domain", + "ioiohkatalaprismwalletsdkpluto.data" + ) + } + } + defaults { - // adds the contents of the reports of `release` Android build variant to default reports - mergeWith("release") + xml { + setReportFile(layout.buildDirectory.file("reports/jvm/result.xml")) + } html { - title = "$currentModuleName - Test Coverage" - setReportDir(layout.buildDirectory.dir("kover/atala-prism-sdk/xml")) - } - xml {} - filters { - excludes { - packages( - "io.iohk.atala.prism.protos", - "io.iohk.atala.prism.walletsdk.domain", - "ioiohkatalaprismwalletsdkpluto.data" - ) - } + title = "Wallet SDK - JVM" + setReportDir(layout.buildDirectory.dir("reports/jvm/html")) + } + } + + androidReports("release") { + xml { + setReportFile(layout.buildDirectory.file("reports/android/result.xml")) + } + html { + title = "Wallet SDK - Android" + setReportDir(layout.buildDirectory.dir("reports/android/html")) } } } @@ -54,6 +73,8 @@ kotlin { } } + applyDefaultHierarchyTemplate() + sourceSets { val commonMain by getting { kotlin.srcDir("${project(":protosLib").buildDir}/generated/source/proto/main/kotlin") @@ -116,7 +137,6 @@ kotlin { } } val androidInstrumentedTest by getting { - dependsOn(commonTest) dependencies { implementation("androidx.test.espresso:espresso-core:3.5.1") implementation("androidx.test.ext:junit:1.1.5")