Skip to content

Commit

Permalink
test: change coverage to jacoco and add coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
amagyar-iohk committed Feb 16, 2024
1 parent 2faf5c6 commit a856e0b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
50 changes: 35 additions & 15 deletions atala-prism-sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
}
}
Expand All @@ -54,6 +73,8 @@ kotlin {
}
}

applyDefaultHierarchyTemplate()

sourceSets {
val commonMain by getting {
kotlin.srcDir("${project(":protosLib").buildDir}/generated/source/proto/main/kotlin")
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit a856e0b

Please sign in to comment.