Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KT-64377 use Java Test Suites for Gradle integration tests #3427

Merged
merged 40 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c31dd23
KT-64377 - remove gradle wrapper files for integration test projects …
adam-enko Dec 19, 2023
61889af
Merge branch 'master' into KT-64377/update-integration-test-build-config
adam-enko Dec 20, 2023
74a1b20
Merge remote-tracking branch 'origin/master' into KT-64377/update-int…
adam-enko Jan 2, 2024
20e0984
refactor integration test properties to use DokkaBuildProperties util…
adam-enko Jan 12, 2024
66287db
Merge branch 'master' into KT-64377/update-integration-test-build-config
adam-enko Jan 12, 2024
28f4d7a
disable explicit API mode in non-published integration-test utilities…
adam-enko Jan 12, 2024
7af0394
Merge remote-tracking branch 'origin/master' into KT-64377/update-int…
adam-enko Jan 15, 2024
10fe4b5
Restructure Gradle Integration tests to use Java Test Suites
adam-enko Jan 15, 2024
5f35a73
revert GitHub smoke test Gradle task back to 'test'
adam-enko Jan 16, 2024
0babb2c
auto-discover and set ANDROID_SDK, and also search for local.properti…
adam-enko Jan 16, 2024
9c6c80e
add TODO link for integration tests - doNotTrackState()
adam-enko Jan 16, 2024
b1c95de
Merge branch 'master' into KT-64377/java-test-suites
adam-enko Jan 22, 2024
28a1c74
tidy up after merge
adam-enko Jan 22, 2024
8a24b4d
Merge remote-tracking branch 'origin/master' into KT-64377/java-test-…
adam-enko Jan 22, 2024
57b93cf
merge cleanup
adam-enko Jan 22, 2024
a974d9b
change plugin `test-suite-base` -> `jvm-test-suite`
adam-enko Jan 23, 2024
852fc7b
move registerTestProjectSuite() to top-level function
adam-enko Jan 23, 2024
ba0c484
move gradle-specific test utils to gradle integration test
adam-enko Jan 23, 2024
6d5ab63
move unused systemVariableProviders.kt back
adam-enko Jan 23, 2024
14364ea
move `multimodule-inter-module-links` to test-suite
adam-enko Jan 23, 2024
84255e2
register DOKKA_TEST_OUTPUT_PATH as a test task input, and the dir as …
adam-enko Jan 23, 2024
37581f2
Merge branch 'master' into KT-64377/java-test-suites
adam-enko Jan 23, 2024
f6d1cca
rm old import
adam-enko Jan 23, 2024
9fe882b
make testOutputPath optional
adam-enko Jan 23, 2024
59594dd
re-add integrationTest lifecycle task
adam-enko Jan 23, 2024
d249e64
fix `it-multimodule-inter-module-links` dir, add property name to tem…
adam-enko Jan 24, 2024
ed0365f
comment to explain test-suites are independent
adam-enko Jan 24, 2024
50a6ef4
add property names to coroutines/serialization project dirs
adam-enko Jan 24, 2024
99fc753
use jvm11 for kotlinx.serialization
adam-enko Jan 24, 2024
47b3dc8
Merge branch 'master' into KT-64377/java-test-suites
adam-enko Jan 26, 2024
cd554b0
revert MaxMetaspaceSize in Coroutines test, and add comment to explain
adam-enko Jan 26, 2024
668c661
environment workaround for https://github.com/gradle/gradle/issues/11534
adam-enko Jan 31, 2024
939d577
update CI build properties
adam-enko Jan 31, 2024
42cd06c
remove `allWarningsAsErrors = false`
adam-enko Jan 31, 2024
df52ca1
remove 'check' task dependency
adam-enko Jan 31, 2024
6eff18d
Merge branch 'master' into KT-64377/java-test-suites
adam-enko Jan 31, 2024
9ec8514
Merge remote-tracking branch 'origin/master' into KT-64377/java-test-…
adam-enko Feb 6, 2024
37a38fb
fix git-checkout task dependencies after merge, so they are more spec…
adam-enko Feb 6, 2024
b1c9a41
fix logging of uri for git-checkout task
adam-enko Feb 6, 2024
f09111e
add invariantSeparatorsPath to androidSdkDir, so it's stable across m…
adam-enko Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/preview-publish-ga.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: :dokka-integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
arguments: :dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
env:
DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/coroutines
- name: Copy files to GitHub Actions Artifacts
Expand All @@ -52,7 +52,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: :dokka-integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
arguments: :dokka-integration-tests:gradle:testExternalProjectKotlinxSerialization --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
env:
DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/serialization
- name: Copy files to GitHub Actions Artifacts
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/preview-publish-web-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: :dokka-integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.CoroutinesGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
arguments: :dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
env:
DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/coroutines
- name: Configure AWS credentials for S3 access
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Print link
run: echo https://dokka-snapshots.s3.eu-central-1.amazonaws.com/${{ env.branch-name }}/coroutines/${GITHUB_SHA::7}/index.html

kotilnx-serialization:
kotlinx-serialization:
runs-on: ubuntu-latest
if: github.repository == 'Kotlin/dokka'
steps:
Expand All @@ -51,7 +51,7 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
arguments: :dokka-integration-tests:gradle:integrationTest --tests org.jetbrains.dokka.it.gradle.kotlin.SerializationGradleIntegrationTest --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
arguments: :dokka-integration-tests:gradle:testExternalProjectKotlinxSerialization --stacktrace "-Dorg.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=500m"
env:
DOKKA_TEST_OUTPUT_PATH: /home/runner/work/dokka/serialization
- name: Configure AWS credentials for S3 access
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests-thorough.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
# Running tests with the Gradle daemon on windows agents leads to some very strange
# JVM crashes for some reason. Most likely a problem of Gradle/GitHub/Windows server
run: >
./gradlew test --stacktrace --no-daemon --no-parallel
./gradlew test --stacktrace --no-daemon --no-parallel --continue
adam-enko marked this conversation as resolved.
Show resolved Hide resolved
"-Dorg.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=500m"
"-Porg.jetbrains.dokka.javaToolchain.testLauncher=${{ matrix.javaVersion }}"
- name: Run tests under Ubuntu/Macos
if: matrix.os != 'windows-latest'
run: >
./gradlew test --stacktrace
./gradlew test --stacktrace --continue
"-Porg.jetbrains.dokka.javaToolchain.testLauncher=${{ matrix.javaVersion }}"
1 change: 0 additions & 1 deletion build-logic/src/main/kotlin/dokkabuild.base.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

import dokkabuild.DokkaBuildProperties
import org.gradle.language.base.plugins.LifecycleBasePlugin.VERIFICATION_GROUP

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ val installMavenBinary by tasks.registering(Sync::class) {
val archives = serviceOf<ArchiveOperations>()
from(
mavenBinary.flatMap { conf ->
@Suppress("UnstableApiUsage")
val resolvedArtifacts = conf.incoming.artifacts.resolvedArtifacts

resolvedArtifacts.map { artifacts ->
Expand Down
30 changes: 30 additions & 0 deletions build-logic/src/main/kotlin/dokkabuild/DokkaBuildProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

package dokkabuild

import org.gradle.api.file.ProjectLayout
import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderFactory
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import java.io.File
import javax.inject.Inject

/**
Expand All @@ -20,8 +22,22 @@ import javax.inject.Inject
*/
abstract class DokkaBuildProperties @Inject constructor(
private val providers: ProviderFactory,
private val layout: ProjectLayout,
) {

private val buildingOnTeamCity: Provider<Boolean> =
providers.environmentVariable("TEAMCITY_VERSION").map(String::isNotBlank)

private val buildingOnGitHub: Provider<Boolean> =
providers.environmentVariable("GITHUB_ACTION").map(String::isNotBlank)

val isCI: Provider<Boolean> =
providers.environmentVariable("CI")
.map(String::isNotBlank)
.orElse(buildingOnTeamCity)
.orElse(buildingOnGitHub)
.orElse(false)

/**
* The main version of Java that should be used to build Dokka source code.
*
Expand Down Expand Up @@ -62,6 +78,20 @@ abstract class DokkaBuildProperties @Inject constructor(
dokkaProperty("integration_test.useK2", String::toBoolean)
.orElse(false)

val androidSdkDir: Provider<File> =
providers
// first try finding a local.properties file in any parent directory
.provider {
generateSequence(layout.projectDirectory.asFile, File::getParentFile)
.mapNotNull { dir -> dir.resolve("local.properties").takeIf(File::exists) }
.flatMap { file -> file.readLines().filter { it.startsWith("sdk.dir=") } }
.firstOrNull()
?.substringAfter("sdk.dir=")
}
// else try getting pre-installed SDK (e.g. via GitHub step setup-android)
.orElse(providers.environmentVariable("ANDROID_SDK_ROOT"))
.orElse(providers.environmentVariable("ANDROID_HOME"))
.map(::File)

private fun <T : Any> dokkaProperty(name: String, convert: (String) -> T) =
providers.gradleProperty("org.jetbrains.dokka.$name").map(convert)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ abstract class GitCheckoutTask @Inject constructor(
exclude(".git/")
}

logger.lifecycle("initialized git repo $uri in ${destination.asFile.orNull}")
logger.lifecycle("initialized git repo ${uri.get()} in ${destination.asFile.get()}")
}

/**
Expand Down
4 changes: 2 additions & 2 deletions dokka-integration-tests/gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Integration tests have fixed git revision number, with the diff patch applied fr

In order to update:

* Checkout the project with the requered revision
* Checkout the project with the required revision
- It's some state of the `master`
* Manually write the diff (or apply the existing one and tweak) to have the project buildable against locally published Dokka of version `for-integration-tests-SNAPSHOT`
* `git diff > $pathToProjectInDokka/project.diff`
Expand All @@ -26,4 +26,4 @@ In order to update:
### Run integration tests with K2 (symbols)

To run integration tests with K2, the property `org.jetbrains.dokka.integration_test.useK2` should be set to `true`.
By default, the task `integrationTest` is run with K1 (descriptors).
By default, the integration tests are run with K1 (descriptors).
Loading
Loading