Test and verify coverage only on debug variant (#2556)

* Test and verify coverage only on debug variant

* Set files to upload

* Fix also nightlyReports flow
This commit is contained in:
Jorge Martin Espinosa
2024-03-15 15:52:33 +01:00
committed by GitHub
parent 1df8f53673
commit b488cbbfb8
4 changed files with 8 additions and 32 deletions

View File

@@ -33,7 +33,7 @@ jobs:
run: ./gradlew verifyPaparazziDebug $CI_GRADLE_ARG_PROPERTIES
- name: 📈 Generate kover report and verify coverage
run: ./gradlew :app:koverHtmlReport :app:koverXmlReport :app:koverVerify $CI_GRADLE_ARG_PROPERTIES -Pci-build=true
run: ./gradlew :app:koverXmlReportGplayDebug :app:koverHtmlReportGplayDebug :app:koverVerifyGplayDebug $CI_GRADLE_ARG_PROPERTIES
- name: ✅ Upload kover report
if: always()

View File

@@ -48,14 +48,14 @@ jobs:
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
- name: ⚙️ Run unit tests, debug and release
run: ./gradlew test $CI_GRADLE_ARG_PROPERTIES
- name: ⚙️ Run unit tests for debug variant
run: ./gradlew testDebugUnitTest $CI_GRADLE_ARG_PROPERTIES
- name: 📸 Run screenshot tests
run: ./gradlew verifyPaparazziDebug $CI_GRADLE_ARG_PROPERTIES
- name: 📈Generate kover report and verify coverage
run: ./gradlew :app:koverHtmlReport :app:koverXmlReport :app:koverVerify $CI_GRADLE_ARG_PROPERTIES -Pci-build=true
run: ./gradlew :app:koverXmlReportGplayDebug :app:koverHtmlReportGplayDebug :app:koverVerifyGplayDebug $CI_GRADLE_ARG_PROPERTIES
- name: 🚫 Upload kover failed coverage reports
if: failure()
@@ -63,7 +63,7 @@ jobs:
with:
name: kover-error-report
path: |
app/build/reports/kover/verify.err
app/build/reports/kover/verifyGplayDebug.err
- name: ✅ Upload kover report (disabled)
if: always()
@@ -85,5 +85,5 @@ jobs:
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# with:
# files: build/reports/kover/xml/report.xml
files: app/build/reports/kover/reportGplayDebug.xml
verbose: true

View File

@@ -24,7 +24,6 @@ import extension.gitBranchName
import extension.gitRevision
import extension.koverDependencies
import extension.setupKover
import org.jetbrains.kotlin.cli.common.toBooleanLenient
plugins {
id("io.element.android-compose-application")
@@ -189,7 +188,7 @@ androidComponents {
val abiCode = abiVersionCodes[name] ?: 0
// Assigns the new version code to output.versionCode, which changes the version code
// for only the output APK, not for the variant itself.
output.versionCode.set((output.versionCode.get() ?: 0) * 10 + abiCode)
output.versionCode.set((output.versionCode.orNull ?: 0) * 10 + abiCode)
}
}
}
@@ -215,26 +214,6 @@ knit {
}
}
val ciBuildProperty = "ci-build"
val isCiBuild = if (project.hasProperty(ciBuildProperty)) {
val raw = project.property(ciBuildProperty) as? String
raw?.toBooleanLenient() == true || raw?.toIntOrNull() == 1
} else {
false
}
kover {
// When running on the CI, run only debug test variants
if (isCiBuild) {
excludeTests {
// Disable instrumentation for debug test tasks
tasks(
"testDebugUnitTest",
)
}
}
}
dependencies {
allLibrariesImpl()
allServicesImpl()

View File

@@ -100,7 +100,6 @@ fun Project.setupKover() {
defaults {
// add reports of both 'debug' and 'release' Android build variants to default reports
mergeWith("gplayDebug")
mergeWith("gplayRelease")
verify {
onCheck = true
@@ -203,8 +202,6 @@ fun Project.setupKover() {
}
}
}
androidReports("gplayRelease") {}
}
}