Skip to content

Commit 8f9c6ab

Browse files
authored
Merge pull request #14 from shinhyo/feat_core_testing
Feat core testing
2 parents a5c42ef + 9743344 commit 8f9c6ab

File tree

81 files changed

+928
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+928
-316
lines changed

.github/workflows/Build.yaml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: Build
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- develop
7-
pull_request:
87

98
concurrency:
109
group: build-${{ github.ref }}
@@ -13,7 +12,7 @@ concurrency:
1312
jobs:
1413
build:
1514
runs-on: ubuntu-latest
16-
timeout-minutes: 60
15+
timeout-minutes: 30
1716

1817
steps:
1918
- name: Checkout
@@ -51,9 +50,30 @@ jobs:
5150
- name: Check Spotless
5251
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
5352

54-
- name: Upload build reports
53+
- name: UnitTest
54+
run: |
55+
./gradlew testDebugUnitTest --stacktrace
56+
57+
- name: Check Kover
58+
run: |
59+
./gradlew koverXmlReportDebug
60+
61+
- name: Display local test coverage
62+
uses: madrapps/[email protected]
63+
with:
64+
title: test coverage report
65+
min-coverage-overall: 40
66+
min-coverage-changed-files: 60
67+
update-comment: true
68+
skip-if-no-changes: true
69+
continue-on-error: false
70+
paths: |
71+
${{ github.workspace }}/feature/**/build/reports/kover/reportDebug.xml
72+
token: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Upload lint reports
5575
if: always()
5676
uses: actions/upload-artifact@v3
5777
with:
5878
name: build-reports
59-
path: app/build/reports
79+
path: app/build/reports

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ build/
99
app/build
1010
build
1111
/.kotlin
12+
/htmlReport/*

README.md

Lines changed: 9 additions & 4 deletions

build-logic/convention/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ dependencies {
2323
compileOnly(libs.compose.gradlePlugin)
2424
compileOnly(libs.kotlin.gradlePlugin)
2525
compileOnly(libs.ksp.gradlePlugin)
26+
compileOnly(libs.kover.gradlePlugin)
2627
}

build-logic/convention/src/main/kotlin/brba.android.application.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ extensions.configure<ApplicationExtension> {
6464
add("implementation", findLibrary("timber"))
6565
add("implementation", findLibrary("coil.kt"))
6666
}
67-
}
67+
}

build-logic/convention/src/main/kotlin/brba.android.feature.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import io.github.shinhyo.brba.buildlogic.androidExtension
2+
import io.github.shinhyo.brba.buildlogic.configureKoverAndroid
23
import io.github.shinhyo.brba.buildlogic.findLibrary
34

45
with(pluginManager) {
56
apply("brba.android.library.compose")
7+
apply("org.jetbrains.kotlin.plugin.serialization")
68
}
79

10+
configureKoverAndroid()
11+
812
androidExtension.apply {
913

1014
dependencies {
@@ -13,6 +17,8 @@ androidExtension.apply {
1317
add("implementation", project(":core:common"))
1418
add("implementation", project(":core:domain"))
1519

20+
add("implementation", findLibrary("kotlinx.serialization.json"))
21+
1622
add("implementation", findLibrary("coil.kt.compose"))
1723

1824
add("implementation", findLibrary("androidx.compose.material3"))
@@ -24,6 +30,8 @@ androidExtension.apply {
2430
add("implementation", findLibrary("androidx.hilt.navigation.compose"))
2531
add("implementation", findLibrary("androidx.lifecycle.runtimeCompose"))
2632
add("implementation", findLibrary("androidx.lifecycle.viewModelCompose"))
33+
34+
add("testImplementation", project(":core:testing"))
2735
}
2836

29-
}
37+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package io.github.shinhyo.brba.buildlogic
2+
3+
import kotlinx.kover.gradle.plugin.dsl.KoverProjectExtension
4+
import org.gradle.api.Project
5+
import org.gradle.kotlin.dsl.assign
6+
import org.gradle.kotlin.dsl.configure
7+
8+
internal fun Project.configureKoverAndroid() {
9+
pluginManager.apply("org.jetbrains.kotlinx.kover")
10+
11+
extensions.configure<KoverProjectExtension> {
12+
13+
// useJacoco()
14+
15+
reports {
16+
filters {
17+
includes {
18+
classes("*ViewModel*")
19+
}
20+
excludes {
21+
classes("*_Factory*", "*_HiltModules*")
22+
}
23+
}
24+
25+
variant("debug") {
26+
html {
27+
onCheck = true
28+
}
29+
30+
xml {
31+
onCheck = true
32+
}
33+
}
34+
35+
}
36+
37+
}
38+
39+
}
40+
41+

0 commit comments

Comments
 (0)