Last active
May 6, 2022 11:10
-
-
Save opatry/6e018eef4e70bc0f82a3bc5d8b3b9f19 to your computer and use it in GitHub Desktop.
CI Test execution on Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subprojects { | |
afterEvaluate { proj -> | |
if (proj.hasProperty('android')) { | |
android { | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} | |
if (proj.hasProperty('kotlin')) { | |
kotlinOptions { | |
jvmTarget = JavaVersion.VERSION_1_8 | |
} | |
} | |
lintOptions { | |
abortOnError false | |
} | |
testOptions { | |
unitTests.all { | |
// let JUnit report mark the job status in case of error | |
ignoreFailures = true | |
testLogging { | |
events "passed", "skipped", "failed" | |
exceptionFormat "short" | |
debug { | |
exceptionFormat "full" | |
} | |
} | |
} | |
} | |
} | |
} | |
if (proj.hasProperty('kotlin') && !proj.hasProperty('android')) { | |
compileKotlin { | |
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 | |
} | |
compileTestKotlin { | |
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 | |
} | |
} | |
if (proj.hasProperty('test')) { | |
test { | |
// let JUnit report mark the job status in case of error | |
ignoreFailures = true | |
testLogging { | |
events "passed", "skipped", "failed" | |
exceptionFormat "short" | |
debug { | |
exceptionFormat "full" | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `test` to trigger as much Jvm tests as possible | |
# `:app:testMyflavorDebugUnitTest` to restrict to only specific flavor(myflavor)+variant(debug) for `:app` module. If no flavor remove `Myflavor`. | |
# `-x :app:test` to remove all tests from `:app` module not being covered by `:app:testMyflavorDebugUnitTest`. | |
# `-x testRelease` to avoid triggering tests both in debug & release build. | |
# `-x :app:build` to avoid triggering useless build tasks (typically for unused flavors). | |
# Only rely on dependencies of `:app:testStandardDebugUnitTest`. | |
./gradlew clean test :app:testStandardDebugUnitTest -x :app:test -x testRelease -x :app:build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment