Skip to content

Commit

Permalink
Use all cores on GHA runners but the half on others
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Mar 31, 2023
1 parent da4a778 commit 5facf7e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Expand Up @@ -22,7 +22,7 @@ java {
tasks.withType<Test>().configureEach {
useJUnitPlatform()

maxParallelForks = if (System.getenv("CI") != null) {
maxParallelForks = if (System.getenv("GITHUB_ACTIONS") != null) {
Runtime.getRuntime().availableProcessors()
} else {
(Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
Expand Down
Expand Up @@ -51,8 +51,10 @@ val integrationTest by tasks.registering(NonCacheableIntegrationTest::class) {
classpath = integrationTestSourceSet.runtimeClasspath

setForkEvery(1)
project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.let { parallelism ->
maxParallelForks = parallelism
maxParallelForks = if (System.getenv("GITHUB_ACTIONS") != null) {
Runtime.getRuntime().availableProcessors()
} else {
(Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
}
environment(
"isExhaustive",
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Expand Up @@ -3,7 +3,6 @@ dokka_version=1.8.20-SNAPSHOT
org.jetbrains.dokka.javaToolchain.mainCompiler=8
org.jetbrains.dokka.javaToolchain.testLauncher=8
org.jetbrains.dokka.kotlinLanguageLevel=1.4
dokka_integration_test_parallelism=2

# Code style
kotlin.code.style=official
Expand Down

0 comments on commit 5facf7e

Please sign in to comment.