Generates combined report after running device tests

Change-Id: I8563b14d0dd0ed927b4feadacc10d102af496e44
ja/coverage_agp_gha_demo_remove
Jose Alcérreca 4 months ago
parent e764f9ff5d
commit 8388d55c4f

@ -107,6 +107,7 @@ jobs:
# Replace task exclusions with `-Pandroidx.baselineprofile.skipgeneration` when
# https://android-review.googlesource.com/c/platform/frameworks/support/+/2602790 landed in a
# release build
- name: Build all build type and flavor permutations
run: ./gradlew :app:assemble :benchmarks:assemble
-x pixel6Api33ProdNonMinifiedReleaseAndroidTest
@ -114,32 +115,29 @@ jobs:
-x collectDemoNonMinifiedReleaseBaselineProfile
-x collectProdNonMinifiedReleaseBaselineProfile
# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod
- name: Generate coverage reports for Debug variants
run: ./gradlew createDemoDebugCombinedCoverageReport
- name: Display local test coverage
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
title: Local test coverage report
paths: |
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v4
with:
name: APKs
path: '**/build/outputs/apk/**/*.apk'
- name: Upload test results (XML)
- name: Upload JVM local results (XML)
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
name: local-test-results
path: '**/build/test-results/test*UnitTest/**.xml'
- name: Upload local coverage reports (XML + HTML)
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-reports
if-no-files-found: error
compression-level: 1
overwrite: false
path: '**/build/reports/jacoco/*'
- name: Check lint
run: ./gradlew :app:lintProdRelease :app-nia-catalog:lintRelease :lint:lint
@ -207,9 +205,28 @@ jobs:
heap-size: 600M
script: ./gradlew connectedDemoDebugAndroidTest --daemon
- name: Run local tests (including Roborazzi) for the combined coverage report (only API 26)
if: matrix.api-level == 26
run: ./gradlew testDemoDebugUnitTest -Proborazzi.test.verify=true # Add Prod if we ever add JVM tests for prod
# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod
- name: Generate coverage reports for Debug variants (only API 26)
if: matrix.api-level == 26
run: ./gradlew createDemoDebugCombinedCoverageReport
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.api-level }}
path: '**/build/reports/androidTests'
- name: Display local test coverage (only API 26)
if: matrix.api-level == 26
id: jacoco
uses: madrapps/jacoco-report@v1.6.1
with:
title: Local test coverage report
paths: |
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml
token: ${{ secrets.GITHUB_TOKEN }}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

@ -67,12 +67,12 @@ internal fun Project.configureJacoco(
val reportTask =
tasks.register("create${variant.name.capitalize()}CombinedCoverageReport", JacocoReport::class) {
if (tasks.findByName(testTaskName) != null) {
dependsOn(testTaskName)
}
if (tasks.findByName(androidtestTaskName) != null) {
dependsOn(androidtestTaskName)
}
// if (tasks.findByName(testTaskName) != null) {
// dependsOn(testTaskName)
// }
// if (tasks.findByName(androidtestTaskName) != null) {
// dependsOn(androidtestTaskName)
// }
classDirectories.setFrom(
allJars,
allDirectories.map { dirs ->

@ -39,3 +39,6 @@ kotlin.code.style=official
# https://developer.android.com/build/releases/gradle-plugin#default-changes
android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false
# Run Roborazzi screenshot tests with the local tests
roborazzi.test.verify=true

Loading…
Cancel
Save