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
This commit is contained in:
Patrick Honkonen 2025-10-28 23:21:50 -04:00
parent e4a2ce0949
commit e040944058
No known key found for this signature in database
GPG Key ID: 27C65CF8B03CC9FB

View File

@ -107,17 +107,17 @@ jobs:
distribution: "temurin"
java-version: ${{ env._JAVA_VERSION }}
- name: Test library modules
- name: Test library modules and generate coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew :core:testDebug :data:testDebug :network:testDebug :ui:testDebug :authenticatorbridge:testDebug :cxf:testDebug
- name: Generate library coverage reports
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew :core:koverXmlReportDebug :data:koverXmlReportDebug :network:koverXmlReportDebug :ui:koverXmlReportDebug :authenticatorbridge:koverXmlReportDebug :cxf:koverXmlReportDebug
./gradlew \
:core:testDebug :core:koverXmlReportDebug \
:data:testDebug :data:koverXmlReportDebug \
:network:testDebug :network:koverXmlReportDebug \
:ui:testDebug :ui:koverXmlReportDebug \
:authenticatorbridge:testDebug :authenticatorbridge:koverXmlReportDebug \
:cxf:testDebug :cxf:koverXmlReportDebug
- name: Upload library test reports
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@ -185,15 +185,10 @@ jobs:
distribution: "temurin"
java-version: ${{ env._JAVA_VERSION }}
- name: Test app module
- name: Test app module and generate coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :app:testStandardDebug
- name: Generate app coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :app:koverXmlReportStandardDebug
run: ./gradlew :app:testStandardDebug :app:koverXmlReportStandardDebug
- name: Upload app test reports
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@ -249,15 +244,10 @@ jobs:
distribution: "temurin"
java-version: ${{ env._JAVA_VERSION }}
- name: Test authenticator module
- name: Test authenticator module and generate coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :authenticator:testDebug
- name: Generate authenticator coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :authenticator:koverXmlReportDebug
run: ./gradlew :authenticator:testDebug :authenticator:koverXmlReportDebug
- name: Upload authenticator test reports
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2