Skip to content

Commit

Permalink
Add new test-runner project that will run tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
TadeasKriz committed Nov 7, 2023
1 parent 3dd5e9a commit c961f6a
Show file tree
Hide file tree
Showing 9 changed files with 406 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,26 @@ abstract class SkiePublishable : Plugin<Project>, HasMavenPublishPlugin, HasSign

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

configureSmokeTestTmpRepository()
configureMetadata(extension)
configureKotlinJvmPublicationIfNeeded()
configureSourcesJar(extension)
configureJavadocJar()
}

private fun Project.configureSmokeTestTmpRepository() {
val smokeTestTmpRepositoryPath: String? by this
smokeTestTmpRepositoryPath?.let {
publishing {
repositories {
maven {
url = uri(it)
name = "smokeTestTmpRepository"
}
}
}
}
}
private fun Project.configureSigningIfNeeded() {
val isRelease = !version.toString().endsWith("SNAPSHOT")
val isPublishing = gradle.startParameter.taskNames.contains("publishToSonatype")
Expand Down
37 changes: 37 additions & 0 deletions test-runner/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import org.gradle.tooling.GradleConnector

plugins {
kotlin("jvm") version "1.9.20"
}

dependencies {
testImplementation(kotlin("test"))
testImplementation(gradleTestKit())
}

val smokeTestRepository = layout.buildDirectory.dir("smokeTestRepo")

val publishSkieToTempMaven by tasks.registering {
doLast {
GradleConnector.newConnector()
.forProjectDirectory(rootDir.resolve("../SKIE"))
.connect()
.use { projectConnection ->
projectConnection.newBuild()
.forTasks("publishAllPublicationsToSmokeTestTmpRepositoryRepository")
.setStandardInput(System.`in`)
.setStandardOutput(System.out)
.setStandardError(System.err)
.addArguments("-PsmokeTestTmpRepositoryPath=${smokeTestRepository.get().asFile.absolutePath}")
.run()
}
}
}

tasks.test {
useJUnitPlatform()

dependsOn(publishSkieToTempMaven)

systemProperty("smokeTestRepository", smokeTestRepository.get().asFile.absolutePath)
}
1 change: 1 addition & 0 deletions test-runner/gradle
1 change: 1 addition & 0 deletions test-runner/gradle.properties
1 change: 1 addition & 0 deletions test-runner/gradlew
1 change: 1 addition & 0 deletions test-runner/gradlew.bat
8 changes: 8 additions & 0 deletions test-runner/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rootProject.name = "test-runner"

dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}
18 changes: 18 additions & 0 deletions test-runner/src/test/kotlin/co/touchlab/skie/test/GradleTests.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package co.touchlab.skie.test

import kotlin.test.assertEquals

class GradleTests {

@Smoke
@SkieTest
@OnlyFor(configurations = [BuildConfiguration.Debug])
@OnlyIos
fun `basic project`(target: BinaryTarget, config: BuildConfiguration, linkage: LinkMode) {
println("Hello $target, $config!")
assertEquals(BinaryTarget.IOS_X64, target)
assertEquals(BuildConfiguration.Debug, config)
// Run tests with param target
}

}
Loading

0 comments on commit c961f6a

Please sign in to comment.