mirror of https://github.com/usbharu/Hideout.git
Compare commits
24 Commits
cb52248b1c
...
ee7bdf66eb
Author | SHA1 | Date |
---|---|---|
usbharu | ee7bdf66eb | |
usbharu | 455c7aea3f | |
usbharu | 4a9b192e84 | |
usbharu | f622d23a7b | |
usbharu | 23fb7f9f2a | |
usbharu | bb6e03461a | |
usbharu | 579ac44372 | |
usbharu | 4eb8127105 | |
usbharu | 031ba79450 | |
usbharu | 95ac60bfec | |
usbharu | e36c7d6fb9 | |
usbharu | ee665eddb3 | |
usbharu | 6ffd675f35 | |
usbharu | af70c18b7a | |
usbharu | 5456413e42 | |
usbharu | 375113f384 | |
usbharu | e6573ccbb3 | |
usbharu | bd74ca1e0f | |
usbharu | a4cfbe81a1 | |
usbharu | 42c6e0b093 | |
usbharu | 26e0679435 | |
usbharu | 572ceacc67 | |
usbharu | f7e151b575 | |
usbharu | f83d47e877 |
|
@ -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
|
||||
|
|
|
@ -217,6 +217,12 @@ kover {
|
|||
}
|
||||
}
|
||||
}
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 ->
|
||||
|
|
Loading…
Reference in New Issue