Compare commits

..

No commits in common. "ee7bdf66eb358689ca909848548432a977174328" and "cb52248b1c24619c1a7e2cfb95374afa18dabb37" have entirely different histories.

5 changed files with 33 additions and 210 deletions

View File

@ -1,14 +1,16 @@
name: pull-request-merge-check.yml
name: PullRequest Merge Check
on:
pull_request:
paths-ignore:
- 'owl/**'
branches:
- "develop"
types:
- opened
- reopened
- synchronize
- ready_for_review
- opened # default
- reopened # default
- synchronize # default
- ready_for_review # 必要
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
@ -20,41 +22,10 @@ permissions:
pull-requests: write
jobs:
change:
setup:
name: Setup
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
@ -77,42 +48,11 @@ jobs:
gradle-home-cache-cleanup: true
- name: Build
run: ./gradlew :hideout-core:classes --no-daemon
run: ./gradlew classes --no-daemon
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'
unit-test:
name: Unit Test
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -135,93 +75,30 @@ jobs:
- name: Unit Test
run: ./hideout-core/gradlew :hideout-core:koverXmlReport
- name: JUnit Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/TEST-*.xml'
check_name: 'hideout-core JUnit Test Report'
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: 'hideout-core.xml'
path: 'hideout-core/build/reports/kover/hideout-core.xml'
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
steps:
- name: Checkout
uses: actions/checkout@v4
with:
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: 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
- 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/hideout-core.xml/hideout-core.xml,
${{ github.workspace }}/hideout-core/build/reports/kover/hideout-mastodon.xml/hideout-mastodon.xml
${{ 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'
- name: Verify Coverage
run: ./hideout-core/gradlew :hideout-core:koverVerify
lint:
needs:
- change
- hideout-core-setup
- hideout-mastodon-setup
name: Lint
needs: [ setup ]
runs-on: ubuntu-latest
permissions:
contents: write
@ -230,7 +107,7 @@ jobs:
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
@ -244,7 +121,7 @@ jobs:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Lint
- name: Build with Gradle
run: ./gradlew :hideout-core:detektMain :hideout-mastodon:detektMain
- name: Auto Commit

View File

@ -211,18 +211,12 @@ 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")
@ -235,7 +229,6 @@ kover {
packages("org.jetbrains")
}
}
}
}

View File

@ -1,4 +1,3 @@
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
@ -7,7 +6,6 @@ plugins {
alias(libs.plugins.spring.boot)
alias(libs.plugins.kotlin.spring)
alias(libs.plugins.detekt)
alias(libs.plugins.kover)
}
@ -133,53 +131,6 @@ 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 Executable file → Normal file
View File

View File

@ -40,11 +40,13 @@ 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 ->