-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable build cache by default in Gradle integration tests (#3716)
* Enable build cache by default in Gradle integration tests Enabling build cache by default will improve performance when re-running the tests locally. Update the test assertions to check that tasks either succeed or are loaded from cache (which does not make a difference in terms of integration tests). Additionally, use `GRADLE_RO_DEP_CACHE` to re-use the host machine's Gradle dependencies cache. This will improve test performance locally and on CI.
- Loading branch information
Showing
18 changed files
with
179 additions
and
97 deletions.
There are no files selected for viewing
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
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
41 changes: 41 additions & 0 deletions
41
...ntegration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/gradleAssertions.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package org.jetbrains.dokka.it.gradle | ||
|
||
import org.gradle.testkit.runner.BuildResult | ||
import org.gradle.testkit.runner.BuildTask | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import kotlin.test.assertContains | ||
import kotlin.test.assertNotNull | ||
|
||
|
||
/** | ||
* Assert that the [BuildResult] has a task in the task graph. | ||
* | ||
* @returns the task, if it exists. | ||
*/ | ||
fun BuildResult.shouldHaveTask(taskPath: String): BuildTask { | ||
val actual = task(taskPath) | ||
assertNotNull(actual) { | ||
"Could not find task $taskPath in BuildResult. All tasks: ${tasks.map { it.path }}" | ||
} | ||
return actual | ||
} | ||
|
||
/** | ||
* Assert that the [outcome][TaskOutcome] of a [BuildTask] is any of [expectedOutcomes]. | ||
*/ | ||
fun BuildTask.shouldHaveOutcome( | ||
vararg expectedOutcomes: TaskOutcome | ||
) { | ||
require(expectedOutcomes.isNotEmpty()) { | ||
"Invalid assertion. Must have at least 1 expected TaskOutcome, but got none." | ||
} | ||
assertContains( | ||
expectedOutcomes.toList(), | ||
outcome, | ||
"Expected that task $path outcome was any of $expectedOutcomes, but was actually $outcome." | ||
) | ||
} |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.