Merge pull request #497 from usbharu/github-action

chore: キャッシュを消した
This commit is contained in:
usbharu 2024-07-30 00:33:36 +09:00 committed by GitHub
commit cc76cb18fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 201 deletions

View File

@ -9,7 +9,9 @@ on:
- reopened # default
- synchronize # default
- ready_for_review # 必要
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
@ -26,48 +28,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/*.kt') }}-${{ github.sha }}
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build
uses: gradle/gradle-build-action@v3.5.0
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: :hideout-core:testClasses
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Build
run: ./gradlew :hideout-core:classes
unit-test:
name: Unit Test
@ -77,109 +54,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Unit Test
uses: gradle/gradle-build-action@v3.5.0
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: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }}
- 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
run: ./gradlew :hideout-core:koverXmlReport
- name: Add coverage report to PR
if: always()
@ -195,18 +83,6 @@ jobs:
min-coverage-changed-files: 80
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
uses: mikepenz/action-junit-report@v4
with:
@ -220,49 +96,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Gradle Wrapper Cache
uses: actions/cache@v4.0.2
with:
path: ~/.gradle/wrapper
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Dependencies Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/cache/jars-*
~/.gradle/caches/transforms-*
~/.gradle/caches/modules-*
key: gradle-dependencies-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: gradle-dependencies-
- name: Cache
uses: actions/cache@v4.0.2
with:
path: |
~/.gradle/caches/build-cache-*
~/.gradle/caches/[0-9]*.*
.gradle
key: ${{ runner.os }}-gradle-build-${{ github.workflow }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-gradle-build-${{ github.workflow }}-
- name: Build Cache
uses: actions/cache@v4.0.2
with:
path: |
build
key: gradle-build-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('src') }}-${{ github.sha }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
arguments: :hideout-core:detektMain
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Build with Gradle
run: ./gradlew :hideout-core:detektMain
- name: Auto Commit
if: ${{ always() }}

View File

@ -36,32 +36,40 @@ dependencies {
implementation(libs.bundles.coroutines)
}
tasks.test {
useJUnitPlatform()
tasks {
test {
useJUnitPlatform()
}
compileKotlin {
dependsOn("openApiGenerateMastodonCompatibleApi")
mustRunAfter("openApiGenerateMastodonCompatibleApi")
}
create<GenerateTask>("openApiGenerateMastodonCompatibleApi") {
generatorName.set("kotlin-spring")
inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml")
outputDir.set("$buildDir/generated/sources/mastodon")
apiPackage.set("dev.usbharu.hideout.mastodon.interfaces.api.generated")
modelPackage.set("dev.usbharu.hideout.mastodon.interfaces.api.generated.model")
configOptions.put("interfaceOnly", "true")
configOptions.put("useSpringBoot3", "true")
configOptions.put("reactive", "true")
configOptions.put("gradleBuildFile", "false")
configOptions.put("useSwaggerUI", "false")
configOptions.put("enumPropertyNaming", "UPPERCASE")
additionalProperties.put("useTags", "true")
importMappings.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")
}
}
kotlin {
jvmToolchain(21)
}
tasks.create<GenerateTask>("openApiGenerateMastodonCompatibleApi", GenerateTask::class) {
generatorName.set("kotlin-spring")
inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml")
outputDir.set("$buildDir/generated/sources/mastodon")
apiPackage.set("dev.usbharu.hideout.mastodon.interfaces.api.generated")
modelPackage.set("dev.usbharu.hideout.mastodon.interfaces.api.generated.model")
configOptions.put("interfaceOnly", "true")
configOptions.put("useSpringBoot3", "true")
configOptions.put("reactive", "true")
configOptions.put("gradleBuildFile", "false")
configOptions.put("useSwaggerUI", "false")
configOptions.put("enumPropertyNaming", "UPPERCASE")
additionalProperties.put("useTags", "true")
importMappings.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")
}
sourceSets.main {
kotlin.srcDirs(
"$buildDir/generated/sources/mastodon/src/main/kotlin"