Skip to content

Commit

Permalink
Updating the gradle version and jacoco report
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuppan committed Jul 22, 2024
1 parent 625b604 commit 70baeea
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,20 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run sub-projects coverage
run: ./gradlew debugCoverage
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run coverage merge
run: ./gradlew allDebugCoverage
- name: Run Module Coverage
run: ./gradlew debugCoverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
directory: ./build/reports/
files: ./build/reports/,./build/reports/allDebugCoverage.xml
- name: Jacoco Report
id: jacoco
uses: madrapps/jacoco-report@v1.2
with:
paths: |
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
title: Code Coverage
debug-mode: false
2 changes: 1 addition & 1 deletion build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

group = "com.naveenapps.expensemanager.buildlogic"

// Configure the build-logic plugins to target JDK 17
// Configure the build-logic plugins to target JDK 19
// This matches the JDK used to build the project, and is not related to what is running on device.
java {
sourceCompatibility = JavaVersion.VERSION_19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
Expand Down Expand Up @@ -62,41 +63,47 @@ private val coverageExclusions = listOf(
)

internal fun Project.configureJacoco() {

configure<JacocoPluginExtension> {
toolVersion = libs.findVersion("jacoco").get().toString()
}

tasks.create("debugCoverage", JacocoReport::class.java) {
tasks.register<JacocoReport>("debugCoverage") {

dependsOn("testDebugUnitTest")

group = "Reporting"

description = "Generate Jacoco coverage reports for the debug build."

reports {
xml.required.set(true)
html.required.set(true)
}

val jClasses = "${project.buildDir}/intermediates/javac/debug/classes"
val kClasses = "${project.buildDir}/tmp/kotlin-classes/debug"
val jClasses = "${buildDir}/intermediates/javac/debug/classes"
val kClasses = "${buildDir}/tmp/kotlin-classes/debug"
val javaClasses = fileTree(jClasses) { exclude(coverageExclusions) }
val kotlinClasses = fileTree(kClasses) { exclude(coverageExclusions) }

classDirectories.setFrom(files(javaClasses, kotlinClasses))

val sourceDirs = listOf(
"${project.projectDir}/src/main/java",
"${project.projectDir}/src/main/kotlin",
"${project.projectDir}/src/debug/java",
"${project.projectDir}/src/debug/kotlin",
"${projectDir}/src/main/java",
"${projectDir}/src/main/kotlin",
"${projectDir}/src/debug/java",
"${projectDir}/src/debug/kotlin",
)

sourceDirectories.setFrom(files(sourceDirs))

/*
executionData.setFrom(
files(
listOf("${project.buildDir}/jacoco/testDebugUnitTest.exec"),
listOf("${buildDir}/jacoco/testDebugUnitTest.exec"),
),
)
*/
}

tasks.withType<Test>().configureEach {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ tasks.withType<Test>().configureEach {
}
}

tasks.create("allDebugCoverage", JacocoReport::class) {
tasks.create<JacocoReport>("allDebugCoverage") {

group = "Reporting"
description = "Generate overall Jacoco coverage report for the debug build."
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
accompanist = "0.34.0"
androidDesugarJdkLibs = "2.0.4"
androidGradlePlugin = "8.3.2"
androidGradlePlugin = "8.5.1"
androidxActivity = "1.9.0"
androidxAppCompat = "1.7.0"
androidxMaterial = "1.12.0"
Expand Down Expand Up @@ -44,7 +44,7 @@ googleOssPlugin = "0.10.6"
spotless = "6.23.0"
hilt = "2.51"
hiltExt = "1.2.0"
jacoco = "0.8.8"
jacoco = "0.8.12"
junit4 = "4.13.2"
kotlin = "1.9.24"
kotlinxCoroutines = "1.8.0"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Mar 31 13:45:24 CEST 2024
#Sat Jul 20 22:34:12 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 70baeea

Please sign in to comment.