From c50fab1f5df47f9ff25474e7663572c0b6b44064 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Wed, 13 Nov 2024 22:38:46 +0100 Subject: [PATCH] ci: Re-run tests that fail due to GitHub runner flakiness (#1096) --- build.gradle | 27 --------------------------- build.gradle.kts | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 27 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 05d6769d1..000000000 --- a/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -plugins { - alias(libs.plugins.android.application) apply false - alias(libs.plugins.android.library) apply false - alias(libs.plugins.android.lint) apply false - alias(libs.plugins.google.ksp) apply false - alias(libs.plugins.kotlin.android) apply false - alias(libs.plugins.kotlin.jvm) apply false - alias(libs.plugins.kotlin.parcelize) apply false - alias(libs.plugins.ktlint) apply false - alias(libs.plugins.aboutlibraries) apply false - alias(libs.plugins.hilt) apply false - alias(libs.plugins.quadrant) apply false -} - -allprojects { - apply plugin: libs.plugins.ktlint.get().pluginId - - plugins.withType(JavaBasePlugin).configureEach { - java { - toolchain.languageVersion = JavaLanguageVersion.of(17) - } - } -} - -tasks.register('clean') { - delete layout.buildDirectory -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..5ab279605 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.android.lint) apply false + alias(libs.plugins.google.ksp) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.kotlin.parcelize) apply false + alias(libs.plugins.ktlint) apply false + alias(libs.plugins.aboutlibraries) apply false + alias(libs.plugins.hilt) apply false + alias(libs.plugins.quadrant) apply false +} + +allprojects { + apply( + plugin = + rootProject.libs.plugins.ktlint + .get() + .pluginId, + ) +} + +// GitHub action runners can timeout resulting in occasional test flakiness. +// Re-run tests on CI to work around this, while disallowing failing tests +// when developing locally. +subprojects { + val isCiBuild = providers.environmentVariable("CI").isPresent + + if (isCiBuild) { + tasks.withType().configureEach { + develocity.testRetry { + maxRetries = 4 + maxFailures = 5 + failOnPassedAfterRetry = false + } + } + } +} + +tasks.register("clean") { + delete(layout.buildDirectory) +}