From 9327d9c7a47f1d4fa49d7e5ec2b63c89a9b179d2 Mon Sep 17 00:00:00 2001 From: Simon Hauck Date: Fri, 3 May 2024 18:33:07 +0200 Subject: [PATCH] #3 enable tests in github CI for the plugin --- .github/workflows/run-tests.yml | 6 +++--- README.md | 6 +++--- build.gradle.kts | 2 +- plugin/build.gradle.kts | 21 +++++++++++++++++++ .../simonhauck/git/process/ProcessWrapper.kt | 2 +- .../simonhauck/git/GitCommandWrapperTest.kt | 2 +- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 01fcbf8..7eef604 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -33,8 +33,8 @@ jobs: ./**/build ./**/node_modules - - name: Run assemble - run: ./gradlew assemble + - name: Run Assemble + run: ./gradlew plugin:assemble assemble - name: Run check - run: ./gradlew check + run: ./gradlew plugin:check check diff --git a/README.md b/README.md index 8063c9f..15b89ab 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,6 @@ addresses some of the shortcomings and provides additional functionalities. ### Important commands and development setup -- To format the code run `./gradlew format` -- To build the project use `./gradlew assemble` -- To run all checks use `./gradlew check` +- To format the code run `./gradlew format` and `./gradlew plugin:format` for the plugin +- To build the project use `./gradlew assemble` and `gradlew plugin:assemble` for the plugin +- To run all checks use `./gradlew check` and `./gradlew plugin:check` for the plugin diff --git a/build.gradle.kts b/build.gradle.kts index 1696e8f..38785db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import java.util.* plugins { id("build.common.kotlin-conventions") apply false } allprojects { - group = "com.github.cryptojuenger.template" + group = "com.github.simonhauck.semantic-versioning" version = readVersionFromFile(file("${rootProject.projectDir.resolve("version.properties")}")) } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 139597f..bb2c11f 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,2 +1,23 @@ +// --------------------------------------------------------------------------------------------------------------------- +// Register delegate tasks +// --------------------------------------------------------------------------------------------------------------------- +listOf( + "build", + "clean", + "assemble", + "check", + "format", + "checkFormat", + "test", + ) + .forEach { taskName -> + tasks.register(taskName) { + group = tasks.first().group + dependsOn(tasksWithNameInSubmodules(taskName)) + } + } +fun tasksWithNameInSubmodules(taskName: String): List { + return subprojects.mapNotNull { it.tasks.findByName(taskName) } +} diff --git a/plugin/git-plugin/src/main/kotlin/com/github/simonhauck/git/process/ProcessWrapper.kt b/plugin/git-plugin/src/main/kotlin/com/github/simonhauck/git/process/ProcessWrapper.kt index af8396e..e764520 100644 --- a/plugin/git-plugin/src/main/kotlin/com/github/simonhauck/git/process/ProcessWrapper.kt +++ b/plugin/git-plugin/src/main/kotlin/com/github/simonhauck/git/process/ProcessWrapper.kt @@ -1,9 +1,9 @@ package com.github.simonhauck.git.process +import java.util.concurrent.TimeUnit import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform import org.zeroturnaround.exec.ProcessExecutor import org.zeroturnaround.exec.stream.LogOutputStream -import java.util.concurrent.TimeUnit internal class ProcessWrapper { diff --git a/plugin/git-plugin/src/test/kotlin/com/github/simonhauck/git/GitCommandWrapperTest.kt b/plugin/git-plugin/src/test/kotlin/com/github/simonhauck/git/GitCommandWrapperTest.kt index a74535d..9e5c28f 100644 --- a/plugin/git-plugin/src/test/kotlin/com/github/simonhauck/git/GitCommandWrapperTest.kt +++ b/plugin/git-plugin/src/test/kotlin/com/github/simonhauck/git/GitCommandWrapperTest.kt @@ -2,11 +2,11 @@ package com.github.simonhauck.git import com.github.simonhauck.git.process.ProcessConfig import com.github.simonhauck.git.process.ProcessResult +import java.io.File import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir -import java.io.File class GitCommandWrapperTest {