Skip to content

Commit 1d9f786

Browse files
committed
Fix ConcurrentModificationException in coverage report generation
Problem: Running tests and coverage report generation as separate Gradle invocations caused a ConcurrentModificationException when Kover tried to access test execution data: Could not determine the dependencies of task ':app:koverGenerateArtifactStandardDebug' > java.util.ConcurrentModificationException (no error message) Root Cause: - Configuration cache is enabled (improves build performance) - Kover's coverage tasks need test execution data from the same Gradle session - Separate invocations = separate Gradle daemon sessions - Coverage report task cannot access test data from previous invocation - Configuration cache + separate invocations = state corruption Solution: Combine test execution and coverage generation into single Gradle command: BEFORE: ./gradlew :app:testStandardDebug ./gradlew :app:koverXmlReportStandardDebug # Fails! AFTER: ./gradlew :app:testStandardDebug :app:koverXmlReportStandardDebug Benefits: - Both tasks run in same Gradle daemon session - Coverage task has access to test execution data - Configuration cache works correctly - No state corruption between invocations Applied to all test jobs: - test-libraries: Combined 6 test + 6 coverage tasks - test-app: Combined test + coverage - test-authenticator: Combined test + coverage
1 parent 9bf7c2a commit 1d9f786

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ jobs:
107107
distribution: "temurin"
108108
java-version: ${{ env._JAVA_VERSION }}
109109

110-
- name: Test library modules
110+
- name: Test library modules and generate coverage
111111
env:
112112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113113
run: |
114-
./gradlew :core:testDebug :data:testDebug :network:testDebug :ui:testDebug :authenticatorbridge:testDebug :cxf:testDebug
115-
116-
- name: Generate library coverage reports
117-
env:
118-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119-
run: |
120-
./gradlew :core:koverXmlReportDebug :data:koverXmlReportDebug :network:koverXmlReportDebug :ui:koverXmlReportDebug :authenticatorbridge:koverXmlReportDebug :cxf:koverXmlReportDebug
114+
./gradlew \
115+
:core:testDebug :core:koverXmlReportDebug \
116+
:data:testDebug :data:koverXmlReportDebug \
117+
:network:testDebug :network:koverXmlReportDebug \
118+
:ui:testDebug :ui:koverXmlReportDebug \
119+
:authenticatorbridge:testDebug :authenticatorbridge:koverXmlReportDebug \
120+
:cxf:testDebug :cxf:koverXmlReportDebug
121121
122122
- name: Upload library test reports
123123
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -185,15 +185,10 @@ jobs:
185185
distribution: "temurin"
186186
java-version: ${{ env._JAVA_VERSION }}
187187

188-
- name: Test app module
189-
env:
190-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
191-
run: ./gradlew :app:testStandardDebug
192-
193-
- name: Generate app coverage report
188+
- name: Test app module and generate coverage
194189
env:
195190
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
196-
run: ./gradlew :app:koverXmlReportStandardDebug
191+
run: ./gradlew :app:testStandardDebug :app:koverXmlReportStandardDebug
197192

198193
- name: Upload app test reports
199194
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -249,15 +244,10 @@ jobs:
249244
distribution: "temurin"
250245
java-version: ${{ env._JAVA_VERSION }}
251246

252-
- name: Test authenticator module
253-
env:
254-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
255-
run: ./gradlew :authenticator:testDebug
256-
257-
- name: Generate authenticator coverage report
247+
- name: Test authenticator module and generate coverage
258248
env:
259249
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260-
run: ./gradlew :authenticator:koverXmlReportDebug
250+
run: ./gradlew :authenticator:testDebug :authenticator:koverXmlReportDebug
261251

262252
- name: Upload authenticator test reports
263253
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

0 commit comments

Comments
 (0)