chore: jetbrainsのを参考に改良2

This commit is contained in:
usbharu 2024-07-30 00:06:09 +09:00
parent ef281f1028
commit 2fe5b1c278
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
2 changed files with 42 additions and 67 deletions

View File

@ -43,7 +43,7 @@ jobs:
gradle-home-cache-cleanup: true gradle-home-cache-cleanup: true
- name: Build - name: Build
run: ./gradlew :hideout-core:testClasses run: ./gradlew :hideout-core:classes
unit-test: unit-test:
name: Unit Test name: Unit Test
@ -59,37 +59,13 @@ jobs:
java-version: '21' java-version: '21'
distribution: 'temurin' distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: Unit Test - name: Unit Test
uses: gradle/gradle-build-action@v3.5.0 run: :hideout-core:koverXmlReport
with:
arguments: :hideout-core:test
- name: Save Test Report
if: always()
uses: actions/cache/save@v4
with:
path: build/test-results
key: unit-test-report-${{ github.sha }}
coverage:
name: Coverage
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Run Kover
uses: gradle/gradle-build-action@v3.5.0
with:
arguments: :hideout-core:koverXmlReport --rerun-tasks
- name: Add coverage report to PR - name: Add coverage report to PR
if: always() if: always()
@ -105,18 +81,6 @@ jobs:
min-coverage-changed-files: 80 min-coverage-changed-files: 80
coverage-counter-type: LINE coverage-counter-type: LINE
report-tests:
name: Report Tests
if: success() || failure()
needs: [ unit-test ]
runs-on: ubuntu-latest
steps:
- name: Restore Test Report
uses: actions/cache/restore@v4
with:
path: build/test-results
key: unit-test-report-${{ github.sha }}
- name: JUnit Test Report - name: JUnit Test Report
uses: mikepenz/action-junit-report@v4 uses: mikepenz/action-junit-report@v4
with: with:
@ -136,10 +100,13 @@ jobs:
java-version: '21' java-version: '21'
distribution: 'temurin' distribution: 'temurin'
- name: Build with Gradle - name: Setup Gradle
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 uses: gradle/actions/setup-gradle@v3
with: with:
arguments: :hideout-core:detektMain gradle-home-cache-cleanup: true
- name: Build with Gradle
run: :hideout-core:detektMain
- name: Auto Commit - name: Auto Commit
if: ${{ always() }} if: ${{ always() }}

View File

@ -36,14 +36,17 @@ dependencies {
implementation(libs.bundles.coroutines) implementation(libs.bundles.coroutines)
} }
tasks.test { tasks {
test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin {
jvmToolchain(21) compileKotlin {
dependsOn("openApiGenerateMastodonCompatibleApi")
mustRunAfter("openApiGenerateMastodonCompatibleApi")
} }
tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask::class) { create<GenerateTask>("openApiGenerateMastodonCompatibleApi") {
generatorName.set("kotlin-spring") generatorName.set("kotlin-spring")
inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml") inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml")
outputDir.set("$buildDir/generated/sources/mastodon") outputDir.set("$buildDir/generated/sources/mastodon")
@ -61,6 +64,11 @@ tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask:
typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile") typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
templateDir.set("$rootDir/templates") templateDir.set("$rootDir/templates")
} }
}
kotlin {
jvmToolchain(21)
}
sourceSets.main { sourceSets.main {
kotlin.srcDirs( kotlin.srcDirs(