mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
CI: Robolectric's jars through Gradle; the bump on the latest main
Android's unit tests fail on main (runs 411, 413, 417, 419, 424): each Robolectric test fails in MavenArtifactFetcher with an IOException. Robolectric downloads its Android framework jars (about 200 MB each) during the tests, and Maven Central refuses some downloads with HTTP 429 (its rate limit). Now Gradle downloads the two jars that the tests use (SDK 28 and SDK 35), with its retries and its cache, and Robolectric runs offline from their directory. -ProbolectricRepoUrl=<a mirror> still makes Robolectric download them itself from that mirror. Gradle tries a refused download again, up to 6 times (gradle.properties). The D-Modem bump checked out the commit that its event names. A run that waited for the run before it therefore built on an old main, and its pull request (#103) conflicted with the one that the earlier run merged (#102). Now it checks out main as it is when the run starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSYSk1rgeTZ9ZWMcZL Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
This commit is contained in:
1 parent
96410bb3bf
commit
62d9defefb
3 files changed
+37
-3
No files matched your search
@@ -51,9 +51,12 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# main as it is now, not the commit the event names: a run that waited for the one before it
|
||||
# (concurrency) builds on the main that the earlier run merged into, and does not conflict with it
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
token: ${{ secrets.DMODEM_BUMP_TOKEN }}
|
||||
ref: main
|
||||
fetch-depth: 0
|
||||
|
||||
# only the D-Modem submodule (proot stays where it is)
|
||||
|
||||
+30
-3
@@ -201,10 +201,37 @@ val buildHostSsh = tasks.register<Exec>("buildHostSsh") {
|
||||
)
|
||||
}
|
||||
|
||||
// Robolectric fetches its Android framework jars itself: -ProbolectricRepoUrl=<a Maven mirror> to fetch them elsewhere
|
||||
// Robolectric's Android framework jars (android-all-instrumented, about 200 MB each), one for each SDK
|
||||
// that a test's @Config names (app/src/test). Gradle downloads them, with its retries and its cache
|
||||
// (CI's setup-gradle keeps the cache). Robolectric then runs offline from their directory.
|
||||
// Without this, Robolectric downloads them itself during the tests, and Maven Central's rate limit
|
||||
// (HTTP 429) makes each Robolectric test fail.
|
||||
// A new SDK in a test's @Config: add its jar here. Robolectric's DefaultSdkProvider gives the version
|
||||
// for its release (libs.versions.toml): "<Android version>-robolectric-<build>-i<instrumentation>".
|
||||
// -ProbolectricRepoUrl=<a Maven mirror>: Robolectric downloads them itself from that mirror instead.
|
||||
val robolectricJars = configurations.create("robolectricJars") {
|
||||
isTransitive = false
|
||||
isCanBeConsumed = false
|
||||
}
|
||||
dependencies {
|
||||
// SDK 28 (Android 9) and SDK 35 (Android 15), Robolectric 4.17's jars
|
||||
robolectricJars("org.robolectric:android-all-instrumented:9-robolectric-4913185-2-i7")
|
||||
robolectricJars("org.robolectric:android-all-instrumented:15-robolectric-13954326-i7")
|
||||
}
|
||||
val robolectricJarsDir = layout.buildDirectory.dir("robolectric-jars")
|
||||
val syncRobolectricJars = tasks.register<Sync>("syncRobolectricJars") {
|
||||
description = "Copies Robolectric's Android framework jars to one directory, for its offline mode"
|
||||
from(robolectricJars)
|
||||
into(robolectricJarsDir)
|
||||
}
|
||||
val robolectricRepoUrl = providers.gradleProperty("robolectricRepoUrl").orNull
|
||||
tasks.withType<Test>().configureEach {
|
||||
providers.gradleProperty("robolectricRepoUrl").orNull?.let {
|
||||
systemProperty("robolectric.dependency.repo.url", it)
|
||||
if (robolectricRepoUrl != null) {
|
||||
systemProperty("robolectric.dependency.repo.url", robolectricRepoUrl)
|
||||
} else {
|
||||
dependsOn(syncRobolectricJars)
|
||||
systemProperty("robolectric.offline", "true")
|
||||
systemProperty("robolectric.dependency.dir", robolectricJarsDir.get().asFile.path)
|
||||
}
|
||||
// the SSH client's JNI library built for the host (native-ssh), for the SSH tests
|
||||
dependsOn(buildHostSsh)
|
||||
|
||||
@@ -3,3 +3,7 @@ org.gradle.caching=true
|
||||
android.useAndroidX=true
|
||||
android.nonTransitiveRClass=true
|
||||
kotlin.code.style=official
|
||||
# A download that Maven Central refuses for a short time (HTTP 429, its rate limit): Gradle tries it again,
|
||||
# up to 6 times, waiting 2 s, then 4 s, and so on (Robolectric's large jars: app/build.gradle.kts)
|
||||
systemProp.org.gradle.internal.repository.max.retries=6
|
||||
systemProp.org.gradle.internal.repository.initial.backoff=2000
|
||||
Reference in new issue
Block a user