diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01744eff..212d1bf1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,11 +36,15 @@ jobs: run: ./gradlew clean --stacktrace - name: Build project skipping tests run: ./gradlew build -x test --stacktrace + - name: Enable test coverage for all modules for instrumentation tests + run: sed -i '' 's/testCoverageEnabled false/testCoverageEnabled true/g' library/build.gradle && sed -i '' 's/testCoverageEnabled false/testCoverageEnabled true/g' utils/build.gradle && sed -i '' 's/testCoverageEnabled false/testCoverageEnabled true/g' sample/build.gradle && sed -i '' 's/testCoverageEnabled false/testCoverageEnabled true/g' wrapper/build.gradle - name: Run Instrumented Tests manually uses: reactivecircus/android-emulator-runner@v2 with: api-level: 22 script: ./gradlew connectedDebug --stacktrace + - name: Disable test coverage for all modules + run: sed -i '' 's/testCoverageEnabled true/testCoverageEnabled false/g' library/build.gradle && sed -i '' 's/testCoverageEnabled true/testCoverageEnabled false/g' utils/build.gradle && sed -i '' 's/testCoverageEnabled true/testCoverageEnabled false/g' sample/build.gradle && sed -i '' 's/testCoverageEnabled true/testCoverageEnabled false/g' wrapper/build.gradle - name: Run jacocoTestReport for each module run: ./gradlew jacocoTestReport --stacktrace --info - name: Merge jacoco reports from all modules diff --git a/README.md b/README.md index c63881c8..129c3a18 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ This is encountered when Robolectric has problems downloading the jars it needs ``` ./download-robolectric-deps.sh +``` ## License diff --git a/library/build.gradle b/library/build.gradle index 34f31ee3..7f6dca38 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -64,7 +64,7 @@ android { debug { // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 - testCoverageEnabled false + testCoverageEnabled true if (project.rootProject.file("local.properties").exists()) { Properties properties = new Properties() @@ -200,7 +200,7 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { // sourceDirectories.setFrom([mainSrc]) classDirectories.setFrom(files([debugTree])) executionData.setFrom(fileTree(dir: project.buildDir, includes: [ - 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' + 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec', 'outputs/code_coverage/**/connected/**/*coverage.ec' ])) } diff --git a/sample/build.gradle b/sample/build.gradle index 30573d48..1182c243 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -41,7 +41,7 @@ android { debug { // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 - testCoverageEnabled false + testCoverageEnabled true buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", localProperties["mapbox.sdk.token"] buildConfigField "String", "CGR_USERNAME", localProperties["cgr.username"] buildConfigField "String", "CGR_PASSWORD", localProperties["cgr.password"] @@ -163,6 +163,6 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { // sourceDirectories.setFrom(files([mainSrc])) classDirectories.setFrom(files([debugTree])) executionData.setFrom(fileTree(dir: project.buildDir, includes: [ - 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' + 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec', 'outputs/code_coverage/**/connected/**/*coverage.ec' ])) } diff --git a/utils/build.gradle b/utils/build.gradle index 2dce714d..cc03ba76 100644 --- a/utils/build.gradle +++ b/utils/build.gradle @@ -37,7 +37,7 @@ android { debug { // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 - testCoverageEnabled false + testCoverageEnabled true } } @@ -92,7 +92,7 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { // sourceDirectories.setFrom(files([mainSrc])) classDirectories.setFrom(files([debugTree])) executionData.setFrom(fileTree(dir: project.buildDir, includes: [ - 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' + 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec', 'outputs/code_coverage/**/connected/**/*coverage.ec' ])) } diff --git a/wrapper/build.gradle b/wrapper/build.gradle index 3ca288ac..5a2e8e45 100644 --- a/wrapper/build.gradle +++ b/wrapper/build.gradle @@ -33,7 +33,7 @@ android { debug { // See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183 - testCoverageEnabled false + testCoverageEnabled true } } @@ -82,6 +82,6 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { // sourceDirectories.setFrom(files([mainSrc])) classDirectories.setFrom(files([debugTree])) executionData.setFrom(fileTree(dir: project.buildDir, includes: [ - 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec' + 'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec', 'outputs/code_coverage/**/connected/**/*coverage.ec' ])) } \ No newline at end of file