Fix native tests in CircleCI (#514)

Fix an issue where the CI job attempts to install the wrong executable
when on macOS/aarch64.

Also, adjusts native test definitions in pkl-server to match pkl-core.
This commit is contained in:
Daniel Chao
2024-06-05 09:05:16 -07:00
committed by GitHub
parent d5ba8fa736
commit 9cc9816440
3 changed files with 65 additions and 18 deletions

View File

@@ -24,15 +24,62 @@ tasks.test {
exclude("**/NativeServerTest.*")
}
val nativeTest by tasks.registering(Test::class) {
dependsOn(":pkl-cli:assembleNative")
private fun Test.configureNativeTest() {
testClassesDirs = files(tasks.test.get().testClassesDirs)
classpath = tasks.test.get().classpath
include("**/NativeServerTest.*")
}
val testNative by tasks.existing
testNative {
dependsOn(nativeTest)
val testMacExecutableAarch64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:macExecutableAarch64")
configureNativeTest()
}
val testMacExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:macExecutableAmd64")
configureNativeTest()
}
val testLinuxExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:linuxExecutableAmd64")
configureNativeTest()
}
val testLinuxExecutableAarch64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:linuxExecutableAarch64")
configureNativeTest()
}
val testAlpineExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:alpineExecutableAmd64")
configureNativeTest()
}
val testWindowsExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:windowsExecutableAmd64")
configureNativeTest()
}
val testNative by tasks.existing
testNative {
when {
buildInfo.os.isMacOsX -> {
dependsOn(testMacExecutableAmd64)
if (buildInfo.arch == "aarch64") {
dependsOn(testMacExecutableAarch64)
}
}
buildInfo.os.isWindows -> {
dependsOn(testWindowsExecutableAmd64)
}
buildInfo.os.isLinux && buildInfo.arch == "aarch64" -> {
dependsOn(testLinuxExecutableAarch64)
}
buildInfo.os.isLinux && buildInfo.arch == "amd64" -> {
dependsOn(testLinuxExecutableAmd64)
if (buildInfo.hasMuslToolchain) {
dependsOn(testAlpineExecutableAmd64)
}
}
}
}