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:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
|
||||||
- 'owl/**'
|
|
||||||
branches:
|
branches:
|
||||||
- "develop"
|
- "develop"
|
||||||
types:
|
types:
|
||||||
- opened # default
|
- opened
|
||||||
- reopened # default
|
- reopened
|
||||||
- synchronize # default
|
- synchronize
|
||||||
- ready_for_review # 必要
|
- ready_for_review
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
@ -22,10 +20,41 @@ permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
change:
|
||||||
name: Setup
|
|
||||||
if: github.event.pull_request.draft == false
|
if: github.event.pull_request.draft == false
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
@ -48,11 +77,42 @@ jobs:
|
||||||
gradle-home-cache-cleanup: true
|
gradle-home-cache-cleanup: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew classes --no-daemon
|
run: ./gradlew :hideout-core:classes --no-daemon
|
||||||
|
|
||||||
unit-test:
|
hideout-mastodon-setup:
|
||||||
name: Unit Test
|
needs:
|
||||||
needs: [ 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: 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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -75,39 +135,30 @@ jobs:
|
||||||
- name: Unit Test
|
- name: Unit Test
|
||||||
run: ./hideout-core/gradlew :hideout-core:koverXmlReport
|
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
|
- name: JUnit Test Report
|
||||||
uses: mikepenz/action-junit-report@v4
|
uses: mikepenz/action-junit-report@v4
|
||||||
with:
|
with:
|
||||||
report_paths: '**/TEST-*.xml'
|
report_paths: '**/TEST-*.xml'
|
||||||
|
check_name: 'hideout-core JUnit Test Report'
|
||||||
|
|
||||||
- name: Verify Coverage
|
- name: Upload Coverage Report
|
||||||
run: ./hideout-core/gradlew :hideout-core:koverVerify
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'hideout-core.xml'
|
||||||
|
path: 'hideout-core/build/reports/kover/hideout-core.xml'
|
||||||
|
|
||||||
lint:
|
|
||||||
name: Lint
|
hideout-mastodon-unit-test:
|
||||||
needs: [ setup ]
|
needs:
|
||||||
|
- hideout-mastodon-setup
|
||||||
|
- change
|
||||||
|
if: github.event.pull_request.draft == false && needs.change.outputs.mastodon == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
token: ${{ secrets.PAT }}
|
||||||
token: '${{ secrets.PAT }}'
|
|
||||||
|
|
||||||
- name: Set up JDK 21
|
- name: Set up JDK 21
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
@ -121,7 +172,79 @@ jobs:
|
||||||
cache-read-only: false
|
cache-read-only: false
|
||||||
gradle-home-cache-cleanup: true
|
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
|
run: ./gradlew :hideout-core:detektMain :hideout-mastodon:detektMain
|
||||||
|
|
||||||
- name: Auto Commit
|
- name: Auto Commit
|
||||||
|
|
|
@ -211,12 +211,18 @@ kover {
|
||||||
reports {
|
reports {
|
||||||
verify {
|
verify {
|
||||||
rule {
|
rule {
|
||||||
bound{
|
bound {
|
||||||
minValue = 50
|
minValue = 50
|
||||||
coverageUnits = CoverageUnit.INSTRUCTION
|
coverageUnits = CoverageUnit.INSTRUCTION
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
total {
|
||||||
|
xml {
|
||||||
|
title = "Hideout Core"
|
||||||
|
xmlFile = file("$buildDir/reports/kover/hideout-core.xml")
|
||||||
|
}
|
||||||
|
}
|
||||||
filters {
|
filters {
|
||||||
excludes {
|
excludes {
|
||||||
annotatedBy("org.springframework.context.annotation.Configuration")
|
annotatedBy("org.springframework.context.annotation.Configuration")
|
||||||
|
@ -229,6 +235,7 @@ kover {
|
||||||
packages("org.jetbrains")
|
packages("org.jetbrains")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
|
||||||
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
|
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
@ -6,6 +7,7 @@ plugins {
|
||||||
alias(libs.plugins.spring.boot)
|
alias(libs.plugins.spring.boot)
|
||||||
alias(libs.plugins.kotlin.spring)
|
alias(libs.plugins.kotlin.spring)
|
||||||
alias(libs.plugins.detekt)
|
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> {
|
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
|
||||||
exclude("**/generated/**")
|
exclude("**/generated/**")
|
||||||
doFirst {
|
doFirst {
|
||||||
|
|
|
@ -40,13 +40,11 @@ class SpringMediaApi(
|
||||||
description: String?,
|
description: String?,
|
||||||
focus: String?,
|
focus: String?,
|
||||||
): ResponseEntity<MediaAttachment> {
|
): ResponseEntity<MediaAttachment> {
|
||||||
|
|
||||||
if (file.size == 0L) {
|
if (file.size == 0L) {
|
||||||
logger.warn("File is empty.")
|
logger.warn("File is empty.")
|
||||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "File is empty.")
|
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "File is empty.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val tempFile = Files.createTempFile("hideout-tmp-file", ".tmp")
|
val tempFile = Files.createTempFile("hideout-tmp-file", ".tmp")
|
||||||
|
|
||||||
Files.newOutputStream(tempFile).use { outputStream ->
|
Files.newOutputStream(tempFile).use { outputStream ->
|
||||||
|
|
Loading…
Reference in New Issue