Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ jobs:
run: ./gradlew jacocoLocalDebugUnitTestReport

- name: Upload coverage to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov --verbose upload-process --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} -n 'service'-${{ github.run_id }} -F service -f app/build/reports/jacoco/jacocoLocalDebugUnitTestReport/jacocoLocalDebugUnitTestReport.xml
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "**/build/reports/jacoco/**/*.xml"
flags: service
fail_ci_if_error: true

instrumentation-tests:
needs: build
Expand Down
63 changes: 40 additions & 23 deletions config/jacoco/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,52 @@ tasks.withType(Test).configureEach {
jacoco.excludes = ['jdk.internal.*']
}

def isAndroidModule = plugins.hasPlugin('com.android.application') || plugins.hasPlugin('com.android.library')
def isKmpModule = plugins.hasPlugin('org.jetbrains.kotlin.multiplatform')
def excludesList = [
'**/databinding/*',
'**/proto/*',
'**/migration/*',
'**/local/room/dao/*',
'**/*_Factory*',
'**/*Hilt*',
'**/*Args*',
'**/*Directions*',
'**/LocalDatabase_Impl*',
'**/*Module*',
'**/data/remote/firebase/base/*',
'**/data/remote/firebase/schema/*Reference*',
'**/data/remote/firebase/FirebaseStorageManager*',
'**/data/remote/firebase/FirestoreDataStore*',
'**/system/channel/LocationSharedFlowCallback*',
]
def testTaskName
def classDirs
def sourceDirs
def execData

if (isAndroidModule) {
testTaskName = 'testLocalDebugUnitTest'
classDirs = 'build/intermediates/classes/localDebug/transformLocalDebugClassesWithAsm/dirs/org/groundplatform/android'
sourceDirs = ['src/main/java/org/groundplatform/android']
Comment thread
andreia-ferreira marked this conversation as resolved.
execData = 'build/jacoco/testLocalDebugUnitTest.exec'
} else if (isKmpModule) {
testTaskName = 'jvmTest'
classDirs = 'build/classes/kotlin/jvm/main'
sourceDirs = ['src/commonMain/kotlin']
execData = 'build/jacoco/jvmTest.exec'
}

tasks.register('jacocoLocalDebugUnitTestReport', JacocoReport) {
dependsOn 'testLocalDebugUnitTest'
dependsOn tasks.named(testTaskName)
group = "Reporting"
description = "Run tests and generate coverage reports"
reports {
csv.required = false
xml.required = true
html.required = true
}
classDirectories.from = fileTree(
dir: 'build/intermediates/classes/localDebug/transformLocalDebugClassesWithAsm/dirs/org/groundplatform/android',
excludes: [
'**/databinding/*',
'**/proto/*',
'**/migration/*',
'**/local/room/dao/*',
'**/*_Factory*',
'**/*Hilt*',
'**/*Args*',
'**/*Directions*',
'**/LocalDatabase_Impl*',
'**/*Module*',
'**/data/remote/firebase/base/*',
'**/data/remote/firebase/schema/*Reference*',
'**/data/remote/firebase/FirebaseStorageManager*',
'**/data/remote/firebase/FirestoreDataStore*',
'**/system/channel/LocationSharedFlowCallback*',
]
)
sourceDirectories.from = files('src/main/java/org/groundplatform/android')
executionData.from = files('build/jacoco/testLocalDebugUnitTest.exec')
classDirectories.from = fileTree(dir: classDirs, excludes: excludesList)
sourceDirectories.from = files(sourceDirs)
executionData.from = files(execData)
}
Comment thread
andreia-ferreira marked this conversation as resolved.
2 changes: 2 additions & 0 deletions core/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ plugins {
alias(libs.plugins.kotlin.serialization)
}

apply(from = "../../config/jacoco/jacoco.gradle")

kotlin {
// We do not add an Android target here because this is a pure domain module.
// Adding an Android target would require the Android Gradle Plugin (AGP) and SDK configuration,
Expand Down
Loading