Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove jacoco and migrate to kover (ACOL-139) #2671

Merged
merged 4 commits into from
Feb 7, 2024
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/gradle-run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,21 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: report
path: app/build/reports/jacoco
path: app/build/reports/kover

- name: Download Test Reports Folder
uses: actions/download-artifact@v4
with:
name: report
path: app/build/reports/jacoco
path: app/build/reports/kover
merge-multiple: true

- name: Upload Test Report
- name: Upload code coverage to codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with:
files: "app/build/reports/jacoco/jacocoReport/jacocoReport.xml"
files: "app/build/reports/kover/report.xml"

- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
Expand Down
1 change: 0 additions & 1 deletion AR-builder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ pipeline {
}
}

sh './gradlew jacocoReport'
wireSend(secret: env.WIRE_BOT_SECRET, message: "**[#${BUILD_NUMBER} Link](${BUILD_URL})** [${SOURCE_BRANCH}] - ✅ SUCCESS 🎉" + "\nLast 5 commits:\n```text\n$lastCommits\n```")
}

Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
private object Dependencies {
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"
const val detektGradlePlugin = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.0"
const val koverGradlePlugin = "org.jetbrains.kotlinx:kover-gradle-plugin:0.7.5"
const val junit = "junit:junit:4.13.2"
const val kluent = "org.amshove.kluent:kluent:1.73"
const val spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.1.2"
Expand All @@ -44,6 +45,7 @@ dependencies {
implementation("com.android.tools.build:gradle:${klibs.versions.agp.get()}")
implementation(Dependencies.kotlinGradlePlugin)
implementation(Dependencies.detektGradlePlugin)
implementation(Dependencies.koverGradlePlugin)
implementation(Dependencies.spotless)
implementation(Dependencies.junit5)

Expand Down
108 changes: 43 additions & 65 deletions buildSrc/src/main/kotlin/scripts/quality.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask

plugins {
id("com.android.application") apply false
id("jacoco")
id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.kotlinx.kover")
}

dependencies {
Expand Down Expand Up @@ -83,71 +83,49 @@ tasks.register("staticCodeAnalysis") {
dependsOn(detektAll)
}

// Jacoco Configuration
val jacocoReport by tasks.registering(JacocoReport::class) {
group = "Quality"
description = "Reports code coverage on tests within the Wire Android codebase"
val buildVariant = "devDebug" // It's not necessary to run unit tests on every variant so we default to "devDebug"
dependsOn("test${buildVariant.capitalize()}UnitTest")

val outputDir = "$buildDir/jacoco/html"
val classPathBuildVariant = buildVariant

reports {
xml.required.set(true)
html.required.set(true)
html.outputLocation.set(file(outputDir))
}

classDirectories.setFrom(
fileTree(project.buildDir) {
include(
"**/classes/**/main/**", // This probably can be removed
"**/tmp/kotlin-classes/$classPathBuildVariant/**"
)
exclude(
"**/R.class",
"**/R\$*.class",
"**/BuildConfig.*",
"**/Manifest*.*",
"**/Manifest$*.class",
"**/*Test*.*",
"**/Injector.*",
"android/**/*.*",
"**/*\$Lambda$*.*",
"**/*\$inlined$*.*",
"**/di/*.*",
"**/*Database.*",
"**/*Response.*",
"**/*Application.*",
"**/*Entity.*",
"**/mock/**",
"**/*Screen*", // These are composable classes
"**/*Kt*", // These are "usually" kotlin generated classes
"**/theme/**/*.*", // Ignores jetpack compose theme related code
"**/common/**/*.*", // Ignores jetpack compose common components related code
"**/navigation/**/*.*" // Ignores jetpack navigation related code
)
}
)

sourceDirectories.setFrom(
fileTree(project.projectDir) {
include("src/main/java/**", "src/main/kotlin/**")
}
)

executionData.setFrom(
fileTree(project.buildDir) {
include("**/*.exec", "**/*.ec")
}
)

doLast { println("Report file: $outputDir/index.html") }
}

tasks.register("testCoverage") {
group = "Quality"
description = "Reports code coverage on tests within the Wire Android codebase."
dependsOn(jacocoReport)
dependsOn("koverXmlReport")
}

koverReport {
defaults {
mergeWith("devDebug")

filters {
excludes {
classes(
"*Fragment",
"*Fragment\$*",
"*Activity",
"*Activity\$*",
"*.databinding.*",
"*.BuildConfig",
"**/R.class",
"**/R\$*.class",
"**/Manifest*.*",
"**/Manifest$*.class",
"**/*Test*.*",
"*NavArgs*",
"*ComposableSingletons*",
"*_HiltModules*",
"*Hilt_*",
)
packages(
"hilt_aggregated_deps",
"com.wire.android.di",
"dagger.hilt.internal.aggregatedroot.codegen",
"com.wire.android.ui.home.conversations.mock",
)
annotatedBy(
"*Generated*",
"*HomeNavGraph*",
"*Destination*",
"*Composable*",
"*Preview*",
)
}
}
}
}
2 changes: 1 addition & 1 deletion kalium
Submodule kalium updated 41 files
+1 −1 .github/workflows/cherry-pick-rc-to-develop.yml
+1 −1 cryptography/src/appleMain/kotlin/com/wire/kalium/cryptography/MLSClientImpl.kt
+18 −13 cryptography/src/commonJvmAndroid/kotlin/com.wire.kalium.cryptography/MLSClientImpl.kt
+1 −1 cryptography/src/commonMain/kotlin/com/wire/kalium/cryptography/IDs.kt
+1 −1 cryptography/src/commonMain/kotlin/com/wire/kalium/cryptography/MLSClient.kt
+1 −1 cryptography/src/jsMain/kotlin/com/wire/kalium/cryptography/MLSClientImpl.kt
+1 −1 gradle/libs.versions.toml
+4 −3 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/call/CallRepository.kt
+4 −1 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/conversation/DecryptedMessageBundleMapper.kt
+21 −15 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/conversation/MLSConversationRepository.kt
+8 −3 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/e2ei/AcmeMapper.kt
+13 −8 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/e2ei/E2EIRepository.kt
+11 −16 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/team/TeamRepository.kt
+3 −0 logic/src/commonMain/kotlin/com/wire/kalium/logic/di/MapperProvider.kt
+21 −9 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt
+5 −4 ...commonMain/kotlin/com/wire/kalium/logic/feature/conversation/MLSConversationsVerificationStatusesHandler.kt
+44 −0 ...c/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/mls/ConversationVerificationStatusChecker.kt
+32 −0 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/mls/EpochChangesObserver.kt
+3 −6 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/e2ei/usecase/EnrollE2EIUseCase.kt
+1 −1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/e2ei/usecase/GetUserE2EIAllCertificatesUseCase.kt
+1 −1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/team/GetUpdatedSelfTeamUseCase.kt
+9 −4 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/call/CallRepositoryTest.kt
+81 −82 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/conversation/MLSConversationRepositoryTest.kt
+75 −0 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/e2ei/AcmeMapperTest.kt
+119 −27 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/e2ei/E2EIRepositoryTest.kt
+40 −21 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/team/TeamRepositoryTest.kt
+7 −84 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/client/RegisterClientUseCaseTest.kt
+98 −5 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/client/RegisterMLSClientUseCaseTest.kt
+2 −2 ...onTest/kotlin/com/wire/kalium/logic/feature/conversation/MLSConversationsVerificationStatusesHandlerTest.kt
+153 −0 ...mmonTest/kotlin/com/wire/kalium/logic/feature/conversation/mls/ConversationVerificationStatusCheckerTest.kt
+151 −198 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/EnrollE2EICertificateUseCaseTest.kt
+10 −5 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/GetE2eiCertificateUseCaseTest.kt
+22 −11 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/GetMembersE2EICertificateStatusesUseCaseTest.kt
+21 −11 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/GetUserE2eiAllCertificateStatusesUseCaseTest.kt
+18 −8 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/GetUserE2eiCertificateStatusUseCaseTest.kt
+6 −6 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/team/GetUpdatedSelfTeamUseCaseTest.kt
+16 −8 ...commonTest/kotlin/com/wire/kalium/logic/util/arrangement/repository/MLSConversationRepositoryArrangement.kt
+0 −3 logic/src/jvmTest/kotlin/com/wire/kalium/logic/architecture/LayerAccessRulesTest.kt
+55 −9 monkeys/README.md
+10 −0 monkeys/docker/Dockerfile
+12 −1 monkeys/docker/docker-compose.yml
Loading