Skip to content

Commit aecdd1b

Browse files
committed
ci: update workflow for SDK 36; refactor JaCoCo coverage configuration
Update the GitHub Actions workflow to install Android SDK 36 packages and transition to module-specific Gradle tasks for testing and reporting. Refactor the JaCoCo task in the app module to correctly identify Kotlin and Java class directories and target specific execution data paths. Additional changes include: - Add funding configuration via Ko-fi - Update CI to use `:app:` namespaced Gradle tasks for unit tests and coverage - Optimize JaCoCo task dependencies by removing redundant coverage report tasks
1 parent 4137a39 commit aecdd1b

5 files changed

Lines changed: 23 additions & 8 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: sphildreth

.github/workflows/android.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- name: Set up Android SDK
3535
uses: android-actions/setup-android@v3
3636

37+
- name: Install Android SDK packages
38+
run: sdkmanager "platforms;android-36" "build-tools;36.0.0" "platform-tools"
39+
3740
- name: Grant execute permission for gradlew
3841
working-directory: src
3942
run: chmod +x gradlew
@@ -44,12 +47,12 @@ jobs:
4447

4548
- name: Run Unit Tests
4649
working-directory: src
47-
run: ./gradlew testDebugUnitTest --stacktrace
50+
run: ./gradlew :app:testDebugUnitTest --stacktrace
4851

4952
- name: Run Instrumented Tests (emulator)
5053
if: false # enable when emulator is set up
5154
working-directory: src
52-
run: ./gradlew connectedDebugAndroidTest --stacktrace
55+
run: ./gradlew :app:connectedDebugAndroidTest --stacktrace
5356

5457
- name: Benchmark (connected)
5558
if: false # enable when device/emulator available
@@ -58,4 +61,4 @@ jobs:
5861

5962
- name: Coverage Report
6063
working-directory: src
61-
run: ./gradlew jacocoTestReport --stacktrace
64+
run: ./gradlew :app:jacocoTestReport --stacktrace

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ This file records notable project changes. It follows the
7979
home, service, and model serialization code by removing dead helpers,
8080
simplifying redundant conditions, and keeping only intentional Android
8181
lifecycle suppressions.
82+
- Updated Android CI to explicitly install Android SDK 36 and run app-qualified
83+
unit-test and JaCoCo tasks from the nested Gradle project.
8284

8385
### Fixed
8486

@@ -96,6 +98,9 @@ This file records notable project changes. It follows the
9698
synchronized.
9799
- Fixed nullable refresh-token response handling so login and token refresh
98100
persistence tolerate v1 responses that omit rotated refresh-token values.
101+
- Fixed the JaCoCo report task so CI coverage uses debug unit-test execution
102+
data and non-instrumented app classes instead of requiring connected Android
103+
coverage.
99104

100105
### Security
101106

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ If the Android SDK is not discovered automatically, set `ANDROID_HOME` before ru
154154
ANDROID_HOME=/path/to/Android/Sdk ./gradlew testDebugUnitTest
155155
```
156156

157-
GitHub Actions currently runs `./gradlew build --stacktrace`, `./gradlew testDebugUnitTest --stacktrace`, and `./gradlew jacocoTestReport --stacktrace`. Connected tests and benchmarks are present in the workflow but disabled until CI has an emulator or device runner.
157+
GitHub Actions installs Android SDK 36 and currently runs `./gradlew build --stacktrace`, `./gradlew :app:testDebugUnitTest --stacktrace`, and `./gradlew :app:jacocoTestReport --stacktrace`. Connected tests and benchmarks are present in the workflow but disabled until CI has an emulator or device runner.
158158

159159
## Documentation
160160

src/app/build.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ dependencies {
149149

150150
// JaCoCo coverage configuration
151151
tasks.register<JacocoReport>("jacocoTestReport") {
152-
dependsOn("testDebugUnitTest", "createDebugCoverageReport")
152+
dependsOn("testDebugUnitTest")
153153

154154
reports {
155155
xml.required.set(true)
@@ -165,14 +165,20 @@ tasks.register<JacocoReport>("jacocoTestReport") {
165165
"android/**/*.*"
166166
)
167167

168-
val debugTree = fileTree(layout.buildDirectory.dir("intermediates/classes/debug")) {
168+
val kotlinDebugTree = fileTree(layout.buildDirectory.dir("intermediates/built_in_kotlinc/debug/compileDebugKotlin/classes")) {
169+
exclude(fileFilter)
170+
}
171+
val javaDebugTree = fileTree(layout.buildDirectory.dir("intermediates/javac/debug/classes")) {
169172
exclude(fileFilter)
170173
}
171174
val mainSrc = "${project.projectDir}/src/main/java"
172175

173176
sourceDirectories.setFrom(files(mainSrc))
174-
classDirectories.setFrom(files(debugTree))
177+
classDirectories.setFrom(files(kotlinDebugTree, javaDebugTree))
175178
executionData.setFrom(fileTree(layout.buildDirectory) {
176-
include("**/*.exec", "**/*.ec")
179+
include(
180+
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec",
181+
"jacoco/testDebugUnitTest.exec"
182+
)
177183
})
178184
}

0 commit comments

Comments
 (0)