Skip to content

Commit

Permalink
minor Windows integration tests improvements (#112)
Browse files Browse the repository at this point in the history
* update to Gradle 8.2.1
* fix KotlinMultiplatformFunctionalTest on Windows
* re-enable integration tests on Windows
* remove custom min/max heap size for workers
* mark min/max heap as optional
* skip CI integration tests on Windows
  • Loading branch information
aSemy authored Aug 15, 2023
1 parent f5fbf50 commit 7660707
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ jobs:
gradle-check:
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
task:
- "check --continue"
include:
- os: macos-latest
task: "check --continue"
- os: ubuntu-latest
task: "check --continue"
- os: windows-latest
# don't run integration tests on Windows because Gradle OOMs https://github.com/adamko-dev/dokkatoo/issues/10
task: "check --continue -x :modules:dokkatoo-plugin-integration-tests:check"
fail-fast: false
uses: ./.github/workflows/gradle_task.yml
with:
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.adamko.dokkatoo.tests.integration

import dev.adamko.dokkatoo.utils.*
import io.kotest.core.annotation.EnabledIf
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
Expand All @@ -18,7 +17,6 @@ import kotlin.io.path.deleteIfExists
*
* Runs Dokka & Dokkatoo, and compares the resulting HTML site.
*/
@EnabledIf(NotWindowsCondition::class) // https://github.com/adamko-dev/dokkatoo/issues/10
class AndroidProjectIntegrationTest : FunSpec({

val tempDir = GradleProjectTest.projectTestTempDir.resolve("it/it-android-0").toFile()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package dev.adamko.dokkatoo.tests.integration

import dev.adamko.dokkatoo.internal.DokkatooConstants.DOKKA_VERSION
import dev.adamko.dokkatoo.utils.*
import dev.adamko.dokkatoo.utils.GradleProjectTest.Companion.projectTestTempDir
import io.kotest.core.annotation.EnabledIf
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.file.shouldBeAFile
import io.kotest.matchers.file.shouldHaveSameStructureAndContentAs
Expand All @@ -19,7 +17,6 @@ import java.io.File
*
* Runs Dokka & Dokkatoo, and compares the resulting HTML site.
*/
@EnabledIf(NotWindowsCondition::class) // https://github.com/adamko-dev/dokkatoo/issues/10
class BasicProjectIntegrationTest : FunSpec({

val tempDir = projectTestTempDir.resolve("it/it-basic").toFile()
Expand Down
3 changes: 0 additions & 3 deletions modules/dokkatoo-plugin/src/main/kotlin/DokkatooBasePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ constructor(
cacheDirectory.convention(dokkatooExtension.dokkatooCacheDirectory)
workerDebugEnabled.convention(false)
workerLogFile.convention(temporaryDir.resolve("dokka-worker.log"))
// increase memory - DokkaGenerator is hungry https://github.com/Kotlin/dokka/issues/1405
workerMinHeapSize.convention("512m")
workerMaxHeapSize.convention("1g")
workerJvmArgs.set(
listOf(
//"-XX:MaxMetaspaceSize=512m",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ constructor(
abstract val workerDebugEnabled: Property<Boolean>
/** @see JavaForkOptions.getMinHeapSize */
@get:Input
@get:Optional
abstract val workerMinHeapSize: Property<String>
/** @see JavaForkOptions.getMaxHeapSize */
@get:Input
@get:Optional
abstract val workerMaxHeapSize: Property<String>
/** @see JavaForkOptions.jvmArgs */
@get:Input
Expand Down Expand Up @@ -113,8 +115,8 @@ constructor(
classpath.from(runtimeClasspath)
forkOptions {
defaultCharacterEncoding = "UTF-8"
minHeapSize = workerMinHeapSize.get()
maxHeapSize = workerMaxHeapSize.get()
minHeapSize = workerMinHeapSize.orNull
maxHeapSize = workerMaxHeapSize.orNull
enableAssertions = true
debug = workerDebugEnabled.get()
jvmArgs = workerJvmArgs.get()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.adamko.dokkatoo.utils


fun String.splitToPair(delimiter: String): Pair<String, String> =
substringBefore(delimiter) to substringAfter(delimiter)

Expand All @@ -11,3 +12,10 @@ fun String.uppercaseFirstChar(): String = mapFirstChar(Character::toTitleCase)
private inline fun String.mapFirstChar(
transform: (Char) -> Char
): String = if (isNotEmpty()) transform(this[0]) + substring(1) else this


/** Split a string into lines, sort the lines, and re-join them (using [separator]). */
fun String.sortLines(separator: String = "\n") =
lines()
.sorted()
.joinToString(separator)
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class KotlinMultiplatformFunctionalTest : FunSpec({
test("with element-list") {
project.projectDir.resolve("build/dokka/html/test/package-list").shouldBeAFile()
project.projectDir.resolve("build/dokka/html/test/package-list").toFile().readText()
.sortLines()
.shouldContain( /* language=text */ """
|${'$'}dokka.format:html-v1
|${'$'}dokka.linkExtension:html
Expand All @@ -67,7 +68,6 @@ class KotlinMultiplatformFunctionalTest : FunSpec({
|${'$'}dokka.location:com.project/Hello/Hello/#/PointingToDeclaration/test/com.project/-hello/-hello.html
|${'$'}dokka.location:com.project/Hello/sayHello/#kotlinx.serialization.json.JsonObject/PointingToDeclaration/test/com.project/-hello/say-hello.html
|com.project
|
""".trimMargin()
)
}
Expand Down

0 comments on commit 7660707

Please sign in to comment.