diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9ff5ee6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI Template + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + verify: + if: ${{ false }} + name: ${{ matrix.project }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + project: + - template/spring-boot-kotlin + - template/spring-boot-kotlin-multi-module + + env: + SPOTLESS_RATCHET_FROM: ${{ github.event.pull_request.base.sha }} + + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - uses: actions/setup-java@v6 + with: + distribution: temurin + java-version: "25" + + - uses: gradle/actions/setup-gradle@v6 + + - name: Spotless Check + working-directory: ${{ matrix.project }} + run: ./gradlew spotlessCheck + + - name: Gradle Test + working-directory: ${{ matrix.project }} + run: ./gradlew test + + - name: Gradle Build + working-directory: ${{ matrix.project }} + run: ./gradlew build diff --git a/AGENTS.md b/AGENTS.md index e41d2c0..73e2e13 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -80,11 +80,13 @@ kotlin scripts/git/git-workflow.main.kts finish TASK_ID - [Must] `spotlessApply`, `test`, `build` 순으로 실행해야 합니다. `check`는 별도로 실행하지 않습니다. ```sh -./gradlew spotlessApply # 전체 파일에 기계적 포맷을 적용합니다. +./gradlew spotlessApply # HEAD 이후 변경된 파일에 기계적 포맷을 적용합니다. ./gradlew test --tests "com.example.mypackage.*" # Task 범위의 패키지 테스트를 실행합니다. ./gradlew build # clean 없이 증분 빌드를 실행합니다. ``` +Spotless의 기준 Git ref는 `-PspotlessRatchetFrom` 또는 `SPOTLESS_RATCHET_FROM`으로 지정합니다. 둘 다 지정하지 않으면 `HEAD`를 사용합니다. PR CI에서는 병합 대상 브랜치의 base SHA를 `SPOTLESS_RATCHET_FROM`으로 전달해 `spotlessCheck`를 실행합니다. + # 주요 디렉터리 아직 작성하지 않았습니다. diff --git a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-application/build.gradle.kts b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-application/build.gradle.kts index e4a89dc..60c8bb5 100644 --- a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-application/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-application/build.gradle.kts @@ -6,7 +6,7 @@ plugins { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-batch/build.gradle.kts b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-batch/build.gradle.kts index 6905934..48a66ca 100644 --- a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-batch/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-batch/build.gradle.kts @@ -11,7 +11,7 @@ base { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-domain/build.gradle.kts b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-domain/build.gradle.kts index 09ec1b7..1a3da6e 100644 --- a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-domain/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-domain/build.gradle.kts @@ -5,7 +5,7 @@ plugins { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-infrastructure/build.gradle.kts b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-infrastructure/build.gradle.kts index 497046f..671a7d9 100644 --- a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-infrastructure/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-infrastructure/build.gradle.kts @@ -5,7 +5,7 @@ plugins { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-presentation/build.gradle.kts b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-presentation/build.gradle.kts index 5f22732..5751d83 100644 --- a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-presentation/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-presentation/build.gradle.kts @@ -12,7 +12,7 @@ base { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-worker/build.gradle.kts b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-worker/build.gradle.kts index be3180a..6023c9c 100644 --- a/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-worker/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/__SPRINGKIT_ARTIFACT__-worker/build.gradle.kts @@ -11,7 +11,7 @@ base { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin-multi-module/build.gradle.kts b/template/spring-boot-kotlin-multi-module/build.gradle.kts index 8950d85..efe2920 100644 --- a/template/spring-boot-kotlin-multi-module/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/build.gradle.kts @@ -1,14 +1,21 @@ plugins { - kotlin("jvm") version "2.3.21" apply false - kotlin("plugin.spring") version "2.3.21" apply false + kotlin("jvm") version "2.2.21" apply false + kotlin("plugin.spring") version "2.2.21" apply false id("org.springframework.boot") version "4.1.1" apply false id("io.spring.dependency-management") version "1.1.7" apply false id("com.epages.restdocs-api-spec") version "0.20.1" apply false id("com.diffplug.spotless") version "8.10.2" } +val spotlessRatchetFrom = + providers + .gradleProperty("spotlessRatchetFrom") + .orElse(providers.environmentVariable("SPOTLESS_RATCHET_FROM")) + .getOrElse("HEAD") + spotless { isEnforceCheck = false + ratchetFrom(spotlessRatchetFrom) kotlinGradle { target("**/*.gradle.kts") @@ -32,6 +39,7 @@ subprojects { configure { isEnforceCheck = false + ratchetFrom(spotlessRatchetFrom) kotlin { target("src/*/kotlin/**/*.kt") diff --git a/template/spring-boot-kotlin-multi-module/declarative-rest-docs/build.gradle.kts b/template/spring-boot-kotlin-multi-module/declarative-rest-docs/build.gradle.kts index 9b6bcce..945bd44 100644 --- a/template/spring-boot-kotlin-multi-module/declarative-rest-docs/build.gradle.kts +++ b/template/spring-boot-kotlin-multi-module/declarative-rest-docs/build.gradle.kts @@ -11,7 +11,7 @@ base { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } diff --git a/template/spring-boot-kotlin/build.gradle.kts b/template/spring-boot-kotlin/build.gradle.kts index 82aa5e2..9847884 100644 --- a/template/spring-boot-kotlin/build.gradle.kts +++ b/template/spring-boot-kotlin/build.gradle.kts @@ -1,6 +1,6 @@ plugins { - kotlin("jvm") version "2.3.21" - kotlin("plugin.spring") version "2.3.21" + kotlin("jvm") version "2.2.21" + kotlin("plugin.spring") version "2.2.21" id("org.springframework.boot") version "4.1.1" id("io.spring.dependency-management") version "1.1.7" id("com.diffplug.spotless") version "8.10.2" @@ -16,7 +16,7 @@ base { java { toolchain { - languageVersion = JavaLanguageVersion.of(21) + languageVersion = JavaLanguageVersion.of(24) } } @@ -24,8 +24,15 @@ repositories { mavenCentral() } +val spotlessRatchetFrom = + providers + .gradleProperty("spotlessRatchetFrom") + .orElse(providers.environmentVariable("SPOTLESS_RATCHET_FROM")) + .getOrElse("HEAD") + spotless { isEnforceCheck = false + ratchetFrom(spotlessRatchetFrom) kotlin { target("src/*/kotlin/**/*.kt")