diff --git a/.github/workflows/test_linux_exports.yml b/.github/workflows/test_linux_exports.yml index e46b39a76d..d5d1e92f60 100644 --- a/.github/workflows/test_linux_exports.yml +++ b/.github/workflows/test_linux_exports.yml @@ -78,12 +78,6 @@ jobs: run: | jlink --add-modules java.base,java.logging --output jre-amd64-linux - - name: Export tests project - run: | - cd modules/kotlin_jvm/harness/tests/ - chmod +x ../../../../bin/godot.linuxbsd.editor.x86_64 - ../../../../bin/godot.linuxbsd.editor.x86_64 --headless --export-release tests_linux - - name: Run Tests run: | cd modules/kotlin_jvm/harness/tests/ diff --git a/.github/workflows/test_macos_exports.yml b/.github/workflows/test_macos_exports.yml index 901f5f8781..ad819d5e7e 100644 --- a/.github/workflows/test_macos_exports.yml +++ b/.github/workflows/test_macos_exports.yml @@ -79,12 +79,6 @@ jobs: jlink --add-modules java.base,java.logging --output jre-arm64-macos mkdir jre-amd64-macos #create a fake jre dir for amd64 so the export is happy. The test will run on arm anyways - - name: Export tests project - run: | - cd modules/kotlin_jvm/harness/tests/ - chmod +x ../../../../bin/godot.macos.editor.${{ matrix.target }}.universal - ../../../../bin/godot.macos.editor.${{ matrix.target }}.universal --headless --export-release tests_macos - - name: Extract app from dmg run: | cd modules/kotlin_jvm/harness/tests/export diff --git a/.github/workflows/test_windows_exports.yml b/.github/workflows/test_windows_exports.yml index 25be5b9e85..ebb041e247 100644 --- a/.github/workflows/test_windows_exports.yml +++ b/.github/workflows/test_windows_exports.yml @@ -78,11 +78,6 @@ jobs: run: | jlink --add-modules java.base,java.logging --output jre-amd64-windows - - name: Export tests project - run: | - cd modules/kotlin_jvm/harness/tests/ - ../../../../bin/godot.windows.editor.x86_64.exe --headless --export-release tests_windows - - name: Run Tests run: | cd modules/kotlin_jvm/harness/tests/ diff --git a/harness/tests/build.gradle.kts b/harness/tests/build.gradle.kts index b33839cea5..dd8f52e845 100644 --- a/harness/tests/build.gradle.kts +++ b/harness/tests/build.gradle.kts @@ -65,15 +65,7 @@ tasks { isIgnoreExitValue = true - val editorExecutable: String = projectDir - .resolve("../../../../bin") - .listFiles() - ?.also { - println("[${it.joinToString()}]") - } - ?.firstOrNull { it.name.startsWith("godot.") } - ?.absolutePath - ?: throw Exception("Could not find editor executable") + val editorExecutable: String = provideEditorExecutable().absolutePath if (HostManager.hostIsMingw) { commandLine( @@ -89,33 +81,52 @@ tasks { ) } } + val exportRelease by registering(Exec::class) { + description = "Exports the tests for the current host OS in release mode" + dependsOn(importResources, build) + + environment("JAVA_HOME", System.getProperty("java.home")) + workingDir = projectDir + + val target = when { + HostManager.hostIsLinux -> "tests_linux" + HostManager.hostIsMac -> "tests_macos" + HostManager.hostIsMingw -> "tests_windows" + else -> throw IllegalStateException("Unsupported OS for exporting") + } + + doFirst { + projectDir.resolve("export").mkdirs() + + commandLine( + provideEditorExecutable().absolutePath, + "--headless", + "--export-release", + target, + ) + } + } register("runGutTests") { group = "verification" dependsOn(importResources) - val editorExecutable: String = projectDir - .resolve("../../../../bin") - .listFiles() - ?.also { - println("[${it.joinToString()}]") - } - ?.firstOrNull { it.name.startsWith("godot.") } - ?.absolutePath - ?: throw Exception("Could not find editor executable") + val editorExecutable: String = provideEditorExecutable().absolutePath setupTestExecution(editorExecutable) } register("runExportedGutTests") { group = "verification" - dependsOn(importResources) + dependsOn(importResources, exportRelease) val testExecutable: String = projectDir .resolve("export") .listFiles() + ?.filter { it.isFile } ?.also { println("Test executables: [${it.joinToString()}]") + it.forEach { file -> file.setExecutable(true) } } ?.firstOrNull { file -> listOf("exe", "x64_64", "app") @@ -185,3 +196,12 @@ fun Exec.setupTestExecution(editorExecutable: String) { ) } } + +fun provideEditorExecutable(): File = (projectDir + .resolve("../../../../bin") + .listFiles() + ?.also { + println("[${it.joinToString()}]") + } + ?.firstOrNull { it.name.startsWith("godot.") } + ?: throw Exception("Could not find editor executable"))