Compare commits

..

24 Commits

Author SHA1 Message Date
usbharu ee7bdf66eb
chore: カバレッジレポート名を修正 2024-09-17 01:47:34 +09:00
usbharu 455c7aea3f
chore: ファイル名を修正 2024-09-17 01:37:19 +09:00
usbharu 4a9b192e84
chore: ファイル名を修正 2024-09-17 01:32:46 +09:00
usbharu f622d23a7b
chore: ファイル名を修正 2024-09-17 01:24:04 +09:00
usbharu 23fb7f9f2a
chore: ファイル名を修正 2024-09-17 01:16:07 +09:00
usbharu bb6e03461a
chore: ファイル名を修正 2024-09-17 00:49:27 +09:00
usbharu 579ac44372
chore: ファイル名を修正 2024-09-17 00:33:36 +09:00
usbharu 4eb8127105
chore: ファイル名を修正 2024-09-17 00:26:33 +09:00
usbharu 031ba79450
chore: ファイル名を修正 2024-09-17 00:16:52 +09:00
usbharu 95ac60bfec
chore: ファイル名を修正 2024-09-17 00:12:37 +09:00
usbharu e36c7d6fb9
chore: ファイル名を修正 2024-09-17 00:04:14 +09:00
usbharu ee665eddb3
chore: アップロード名を間違えていたので修正 2024-09-16 23:56:38 +09:00
usbharu 6ffd675f35
chore: gradlewのパーミッションを設定 2024-09-16 23:46:39 +09:00
usbharu af70c18b7a
chore: outputの設定を間違えていたので修正 2024-09-16 23:42:34 +09:00
usbharu 5456413e42
chore: mastodonでもカバレッジ率を計測するように 2024-09-16 23:39:12 +09:00
usbharu 375113f384
chore: 権限を修正 2024-09-16 23:17:56 +09:00
usbharu e6573ccbb3
chore: カバレッジレポートの集計場所を修正 2024-09-16 23:12:50 +09:00
usbharu bd74ca1e0f
chore: カバレッジレポートの集計場所を修正 2024-09-16 23:02:18 +09:00
usbharu a4cfbe81a1
chore: カバレッジレポートの集計場所を修正 2024-09-16 22:51:46 +09:00
usbharu 42c6e0b093
Merge remote-tracking branch 'origin/controller-test' into controller-test 2024-09-16 22:43:58 +09:00
usbharu 26e0679435
chore: Javaのバージョンを指定 2024-09-16 22:43:47 +09:00
usbharu 572ceacc67 style: fix lint (CI) 2024-09-16 13:40:48 +00:00
usbharu f7e151b575
chore: CIを改善 2024-09-16 22:37:44 +09:00
usbharu f83d47e877
chore: CIを改善 2024-09-16 22:34:24 +09:00
5 changed files with 217 additions and 40 deletions

View File

@ -1,16 +1,14 @@
name: PullRequest Merge Check
name: pull-request-merge-check.yml
on:
pull_request:
paths-ignore:
- 'owl/**'
branches:
- "develop"
types:
- opened # default
- reopened # default
- synchronize # default
- ready_for_review # 必要
- opened
- reopened
- synchronize
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
@ -22,10 +20,41 @@ permissions:
pull-requests: write
jobs:
setup:
name: Setup
change:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
mastodon: ${{ steps.filter.outputs.mastodon }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Check Changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
core:
- 'hideout-core/**'
- 'libs.versions.toml'
ap:
- 'hideout-activitypub/**'
- 'libs.versions.toml'
mastodon:
- 'hideout-mastodon/**'
- 'libs.versions.toml'
owl:
- 'owl/**'
- 'libs.versions.toml'
hideout-core-setup:
needs:
- change
if: github.event.pull_request.draft == false && needs.change.outputs.core == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
@ -48,11 +77,42 @@ jobs:
gradle-home-cache-cleanup: true
- name: Build
run: ./gradlew classes --no-daemon
run: ./gradlew :hideout-core:classes --no-daemon
unit-test:
name: Unit Test
needs: [ setup ]
hideout-mastodon-setup:
needs:
- change
if: github.event.pull_request.draft == false && needs.change.outputs.mastodon == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Build
run: ./gradlew :hideout-mastodon:classes --no-daemon
hideout-core-unit-test:
needs:
- hideout-core-setup
- change
if: github.event.pull_request.draft == false && needs.change.outputs.core == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -75,39 +135,30 @@ jobs:
- name: Unit Test
run: ./hideout-core/gradlew :hideout-core:koverXmlReport
- name: Add coverage report to PR
if: always()
id: kover
uses: madrapps/jacoco-report@v1.7.0
with:
paths: |
${{ github.workspace }}/hideout-core/build/reports/kover/report.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage
update-comment: true
min-coverage-overall: 50
min-coverage-changed-files: 80
- name: JUnit Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/TEST-*.xml'
check_name: 'hideout-core JUnit Test Report'
- name: Verify Coverage
run: ./hideout-core/gradlew :hideout-core:koverVerify
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: 'hideout-core.xml'
path: 'hideout-core/build/reports/kover/hideout-core.xml'
lint:
name: Lint
needs: [ setup ]
hideout-mastodon-unit-test:
needs:
- hideout-mastodon-setup
- change
if: github.event.pull_request.draft == false && needs.change.outputs.mastodon == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: '${{ secrets.PAT }}'
token: ${{ secrets.PAT }}
- name: Set up JDK 21
uses: actions/setup-java@v4
@ -121,7 +172,79 @@ jobs:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Build with Gradle
- name: Unit Test
run: ./hideout-mastodon/gradlew :hideout-mastodon:koverXmlReport
- name: JUnit Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/TEST-*.xml'
check_name: 'hideout-mastodon JUnit Test Report'
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: 'hideout-mastodon.xml'
path: 'hideout-mastodon/build/reports/kover/hideout-mastodon.xml'
coverage:
needs:
- change
- hideout-core-unit-test
- hideout-mastodon-unit-test
runs-on: ubuntu-latest
steps:
- name: Download Coverage Report
uses: actions/download-artifact@v4
with:
path: 'hideout-core/build/reports/kover'
- run: ls -R hideout-core/build/reports/kover
- run: cat ${{ github.workspace }}/hideout-core/build/reports/kover/hideout-core.xml/hideout-core.xml
- run: cat ${{ github.workspace }}/hideout-core/build/reports/kover/hideout-mastodon.xml/hideout-mastodon.xml
- name: Report Coverage
uses: madrapps/jacoco-report@v1.7.0
with:
paths: |
${{ github.workspace }}/hideout-core/build/reports/kover/hideout-core.xml/hideout-core.xml,
${{ github.workspace }}/hideout-core/build/reports/kover/hideout-mastodon.xml/hideout-mastodon.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage
update-comment: true
min-coverage-overall: 50
min-coverage-changed-files: 80
lint:
needs:
- change
- hideout-core-setup
- hideout-mastodon-setup
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Lint
run: ./gradlew :hideout-core:detektMain :hideout-mastodon:detektMain
- name: Auto Commit

View File

@ -211,12 +211,18 @@ kover {
reports {
verify {
rule {
bound{
bound {
minValue = 50
coverageUnits = CoverageUnit.INSTRUCTION
}
}
}
total {
xml {
title = "Hideout Core"
xmlFile = file("$buildDir/reports/kover/hideout-core.xml")
}
}
filters {
excludes {
annotatedBy("org.springframework.context.annotation.Configuration")
@ -229,6 +235,7 @@ kover {
packages("org.jetbrains")
}
}
}
}

View File

@ -1,3 +1,4 @@
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
@ -6,6 +7,7 @@ plugins {
alias(libs.plugins.spring.boot)
alias(libs.plugins.kotlin.spring)
alias(libs.plugins.detekt)
alias(libs.plugins.kover)
}
@ -131,6 +133,53 @@ configurations.matching { it.name == "detekt" }.all {
}
}
project.gradle.taskGraph.whenReady {
if (this.hasTask(":koverGenerateArtifact")) {
val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true
}
}
kover {
currentProject {
sources {
}
}
reports {
verify {
rule {
bound {
minValue = 50
coverageUnits = CoverageUnit.INSTRUCTION
}
}
}
total {
xml {
title = "Hideout Mastodon"
xmlFile = file("$buildDir/reports/kover/hideout-mastodon.xml")
}
}
filters {
excludes {
annotatedBy("org.springframework.context.annotation.Configuration")
annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties")
packages(
"dev.usbharu.hideout.controller.mastodon.generated",
"dev.usbharu.hideout.domain.mastodon.model.generated"
)
packages("org.springframework")
packages("org.jetbrains")
}
}
}
}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**")
doFirst {

0
hideout-mastodon/gradlew vendored Normal file → Executable file
View File

View File

@ -40,13 +40,11 @@ class SpringMediaApi(
description: String?,
focus: String?,
): ResponseEntity<MediaAttachment> {
if (file.size == 0L) {
logger.warn("File is empty.")
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "File is empty.")
}
val tempFile = Files.createTempFile("hideout-tmp-file", ".tmp")
Files.newOutputStream(tempFile).use { outputStream ->