Skip to content

Commit 30c597e

Browse files
committed
[WIP] Add new test-runner.
1 parent dab30e0 commit 30c597e

File tree

76 files changed

+2232
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2232
-6
lines changed

.github/workflows/new-smoke-tests.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Smoke Tests [New]
2+
3+
# on:
4+
# push:
5+
# branches:
6+
# - '**'
7+
8+
permissions:
9+
contents: read
10+
checks: write
11+
12+
jobs:
13+
demo:
14+
name: Demo Tests
15+
runs-on: ${{ matrix.host }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
target: [ios_arm64, macos_arm64 ... ]
20+
link_mode: [static, dynamic]
21+
build_configuration: [debug, release]
22+
kotlin: [1.8.0, 1.8.10, 1.8.20, 1.8.21, 1.8.22, 1.9.0, 1.9.10, 1.9.20, 1.9.21, 1.9.22]
23+
k2enabled: [true, false]
24+
xcode: ["15.0"]
25+
host: [macos-14, macos-13, macos-12, ubuntu-latest, windows-latest]
26+
include:
27+
- host: green
28+
- color: pink
29+
animal: cat
30+
- fruit: apple
31+
shape: circle
32+
- fruit: banana
33+
- fruit: banana
34+
animal: cat
35+
36+
steps:
37+
- uses: touchlab/SKIE@tk/smoke-tests
38+
with:
39+
github-token: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
40+
gradle:
41+
name: Gradle Tests
42+
runs-on: self-hosted
43+
steps:
44+
- uses: touchlab/SKIE@tk/smoke-tests
45+
with:
46+
github-token: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
47+
acceptance:
48+
name: Acceptance Tests
49+
runs-on: self-hosted
50+
steps:
51+
- uses: touchlab/SKIE@tk/smoke-tests
52+
with:
53+
github-token: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
54+
type-mapping:
55+
name: Type Mapping Tests
56+
runs-on: self-hosted
57+
steps:
58+
- uses: touchlab/SKIE@tk/smoke-tests
59+
with:
60+
github-token: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
61+
libraries:
62+
name: External Libraries Tests
63+
runs-on: self-hosted
64+
steps:
65+
- uses: touchlab/SKIE@tk/smoke-tests
66+
with:
67+
github-token: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
68+
performance:
69+
name: Performance Tests
70+
runs-on: self-hosted
71+
steps:
72+
- uses: touchlab/SKIE@tk/smoke-tests
73+
with:
74+
github-token: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}

SKIE/.run/Latest_Tests_Acceptance_Selected.run.xml renamed to SKIE/.run/Tests_Acceptance_Selected.run.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ExternalSystemSettings>
44
<option name="env">
55
<map>
6-
<entry key="acceptanceTest" value="tests/coroutines/suspend/type_params_copied" />
6+
<entry key="acceptanceTest" value="tests/coroutines/suspend/objects" />
77
</map>
88
</option>
99
<option name="executionName" />
@@ -26,4 +26,4 @@
2626
<RunAsTest>false</RunAsTest>
2727
<method v="2" />
2828
</configuration>
29-
</component>
29+
</component>

build-setup/src/main/kotlin/co/touchlab/skie/buildsetup/plugins/DevAcceptanceTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ abstract class DevAcceptanceTests : Plugin<Project> {
237237
attributes {
238238
attribute(KotlinCompilerVersion.attribute, objects.named(target.kotlinToolingVersion.value))
239239
attribute(KotlinPlatformType.attribute, KotlinPlatformType.native)
240-
attribute(KotlinNativeTarget.konanTargetAttribute, MacOsCpuArchitecture.getCurrent().konanTarget)
240+
attributeProvider(KotlinNativeTarget.konanTargetAttribute, provider { MacOsCpuArchitecture.getCurrent().konanTarget })
241241
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, KotlinUsages.KOTLIN_API))
242242
}
243243
}

build-setup/src/main/kotlin/co/touchlab/skie/buildsetup/plugins/SkiePublishable.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,27 @@ abstract class SkiePublishable : Plugin<Project>, HasMavenPublishPlugin, HasSign
2929

3030
val extension = extensions.create<SkiePublishingExtension>("skiePublishing")
3131

32+
configureSmokeTestTmpRepository()
3233
configureMetadata(extension)
3334
configureKotlinJvmPublicationIfNeeded()
3435
configureSourcesJar(extension)
3536
configureJavadocJar()
3637
}
3738

39+
private fun Project.configureSmokeTestTmpRepository() {
40+
val smokeTestTmpRepositoryPath: String? by this
41+
smokeTestTmpRepositoryPath?.let {
42+
publishing {
43+
repositories {
44+
maven {
45+
url = uri(it)
46+
name = "smokeTestTmp"
47+
}
48+
}
49+
}
50+
}
51+
}
52+
3853
private fun Project.configureSigningIfNeeded() {
3954
val isRelease = !version.toString().endsWith("SNAPSHOT")
4055
val isPublishing = gradle.startParameter.taskNames.contains("publishToSonatype")

common-gradle/gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ touchlab.key=ABCDEFGHIJKLMNOPQRSTUVWXYZ
1717
skieRuntimeVariantFallback=true
1818

1919
kotlinNativeCompilerEmbeddableFromHome=false
20+
21+
#org.gradle.configuration-cache=true
22+
23+
#junit.jupiter.execution.parallel.enabled = true
24+
#junit.jupiter.execution.parallel.mode.default = concurrent
25+
#junit.jupiter.execution.parallel.mode.classes.default = concurrent

common-gradle/gradle/libs.versions.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
java = "11"
33
kotlin = "1.8.21"
44
pluginPublish = "1.2.0"
5-
kotest = "5.4.0"
5+
kotest = "5.8.0"
66
buildconfig = "4.1.1"
77
ktor = "2.2.3"
88
nexusPublish = "2.0.0-rc-1"
@@ -33,7 +33,7 @@ kotlinx-serialization-yaml = { module = "com.charleskorn.kaml:kaml", version = "
3333
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
3434
kotlinx-coroutines-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "coroutines" }
3535
jackson-databind = { module = " com.fasterxml.jackson.core:jackson-databind", version = "2.14.2" }
36-
kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.12.0" }
36+
kotlinPoet = { module = "com.squareup:kotlinpoet", version = "1.15.1" }
3737
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
3838
apache-compress = { module = "org.apache.commons:commons-compress", version = "1.22" }
3939
logback = { module = "ch.qos.logback:logback-classic", version = "1.4.14" }
@@ -45,13 +45,15 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
4545
kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "kotest" }
4646
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest" }
4747
kotest-framework-datatest = { module = "io.kotest:kotest-framework-datatest-jvm", version.ref = "kotest" }
48+
kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" }
4849
mockk = { module = "io.mockk:mockk", version = "1.12.5" }
4950

5051
[bundles]
5152
kotest = [
5253
"kotest-runner-junit5",
5354
"kotest-assertions-core",
5455
"kotest-framework-datatest",
56+
"kotest-property",
5557
]
5658
testing-jvm = [
5759
"kotlin-test",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

test-runner/build.gradle.kts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import co.touchlab.skie.PublishSkieToTempMavenTask
2+
import org.gradle.tooling.GradleConnector
3+
4+
plugins {
5+
kotlin("jvm") version "1.9.22"
6+
}
7+
8+
dependencies {
9+
implementation(kotlin("test"))
10+
implementation(gradleTestKit())
11+
implementation(libs.kotlinPoet)
12+
implementation(libs.bundles.kotest)
13+
}
14+
15+
println("Start: ${gradle.startParameter}")
16+
17+
val smokeTestRepository = layout.buildDirectory.dir("smokeTestRepo")
18+
19+
20+
val publishSkieToTempMaven by tasks.registering(PublishSkieToTempMavenTask::class) {
21+
skieSources = rootDir.resolve("../SKIE")
22+
tempRepository = smokeTestRepository
23+
}
24+
25+
testing {
26+
suites {
27+
val test by getting(JvmTestSuite::class) {
28+
useJUnitJupiter("5.10.1")
29+
30+
dependencies {
31+
implementation("org.junit.platform:junit-platform-suite:1.10.2")
32+
implementation("org.junit.platform:junit-platform-reporting:1.10.2")
33+
}
34+
35+
targets.all {
36+
testTask.configure {
37+
minHeapSize = "1024m"
38+
maxHeapSize = "4024m"
39+
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
40+
41+
dependsOn(publishSkieToTempMaven)
42+
43+
systemProperty("smokeTestRepository", smokeTestRepository.get().asFile.absolutePath)
44+
systemProperty("junit.platform.reporting.open.xml.enabled", "true")
45+
systemProperty("junit.platform.reporting.output.dir", reports.junitXml.outputLocation.get().asFile.absolutePath.also {
46+
println("Junitxml: ${it}")
47+
})
48+
49+
listOf(
50+
"testLevel",
51+
"testTypes",
52+
"matrix.targets",
53+
"matrix.configurations",
54+
"matrix.linkModes",
55+
"matrix.kotlinVersions",
56+
"matrix.gradleVersions",
57+
).forEach { property ->
58+
val propertyValue = findProperty(property) ?: return@forEach
59+
systemProperty(property, propertyValue)
60+
}
61+
62+
testLogging {
63+
events("passed", "skipped", "failed")
64+
showStandardStreams = true
65+
}
66+
}
67+
}
68+
}
69+
}
70+
}

test-runner/buildSrc/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package co.touchlab.skie
2+
3+
import org.gradle.api.DefaultTask
4+
import org.gradle.api.file.DirectoryProperty
5+
import org.gradle.api.model.ObjectFactory
6+
import org.gradle.api.tasks.InputDirectory
7+
import org.gradle.api.tasks.Internal
8+
import org.gradle.api.tasks.OutputDirectory
9+
import org.gradle.api.tasks.TaskAction
10+
import org.gradle.tooling.GradleConnector
11+
import javax.inject.Inject
12+
13+
abstract class PublishSkieToTempMavenTask @Inject constructor(objects: ObjectFactory): DefaultTask() {
14+
// This is @Internal because we only want `.kt` files to be considered as inputs, which we do in `init { }`
15+
@get:Internal
16+
val skieSources: DirectoryProperty = objects.directoryProperty()
17+
18+
@get:OutputDirectory
19+
val tempRepository: DirectoryProperty = objects.directoryProperty()
20+
21+
init {
22+
inputs.files(skieSources.map { it.asFileTree.matching { this.include { it.file.extension == "kt" } }.also { println(it.files.joinToString("\n") { it.absolutePath }) } })
23+
}
24+
25+
@TaskAction
26+
fun publish() {
27+
GradleConnector.newConnector()
28+
.forProjectDirectory(skieSources.get().asFile)
29+
.connect()
30+
.use { projectConnection ->
31+
projectConnection.newBuild()
32+
.forTasks("publishAllPublicationsToSmokeTestTmpRepository")
33+
.setStandardInput(System.`in`)
34+
.setStandardOutput(System.out)
35+
.setStandardError(System.err)
36+
.addArguments("-PsmokeTestTmpRepositoryPath=${tempRepository.get().asFile.absolutePath}")
37+
.run()
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)