Compare commits

..

2 Commits

2 changed files with 44 additions and 54 deletions

View File

@ -85,15 +85,17 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage title: Code Coverage
update-comment: true update-comment: true
min-coverage-overall: 80 min-coverage-overall: 50
min-coverage-changed-files: 80 min-coverage-changed-files: 80
coverage-counter-type: LINE
- 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'
- name: Verify Coverage
run: ./hideout-core/gradlew :hideout-core:koverVerify
lint: lint:
name: Lint name: Lint
needs: [ setup ] needs: [ setup ]

View File

@ -19,6 +19,7 @@ import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.importer.DependencyDataImporter import com.github.jk1.license.importer.DependencyDataImporter
import com.github.jk1.license.importer.XmlReportImporter import com.github.jk1.license.importer.XmlReportImporter
import com.github.jk1.license.render.* import com.github.jk1.license.render.*
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
@ -37,19 +38,6 @@ apply {
group = "dev.usbharu" group = "dev.usbharu"
version = "0.0.1" version = "0.0.1"
tasks.withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.naming/javax.naming=ALL-UNNAMED",
"--add-opens", "java.base/java.util.concurrent.locks=ALL-UNNAMED"
).toMutableList()
}
}
kotlin { kotlin {
jvmToolchain(21) jvmToolchain(21)
compilerOptions { compilerOptions {
@ -85,8 +73,7 @@ repositories {
} }
val os = org.gradle.nativeplatform.platform.internal val os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem()
.DefaultNativePlatform.getCurrentOperatingSystem()
dependencies { dependencies {
developmentOnly(libs.h2db) developmentOnly(libs.h2db)
@ -173,35 +160,40 @@ configurations {
} }
} }
tasks {
//tasks{ withType<io.gitlab.arturbosch.detekt.Detekt> {
// bootRun {
// sourceResources(sourceSets.main.get())
// }
//}
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**") exclude("**/generated/**")
doFirst {
}
setSource("src/main/kotlin") setSource("src/main/kotlin")
exclude("build/") exclude("build/")
configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
}
withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>() {
configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
}
withType<Test> {
useJUnitPlatform()
doFirst {
jvmArgs = arrayOf(
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.naming/javax.naming=ALL-UNNAMED",
"--add-opens",
"java.base/java.util.concurrent.locks=ALL-UNNAMED"
).toMutableList()
}
}
} }
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configureEach {
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
}
project.gradle.taskGraph.whenReady { project.gradle.taskGraph.whenReady {
println(this.allTasks)
this.allTasks.map { println(it.name) }
if (this.hasTask(":koverGenerateArtifact")) { if (this.hasTask(":koverGenerateArtifact")) {
println("has task")
val task = this.allTasks.find { it.name == "test" } val task = this.allTasks.find { it.name == "test" }
val verificationTask = task as VerificationTask val verificationTask = task as VerificationTask
verificationTask.ignoreFailures = true verificationTask.ignoreFailures = true
@ -211,23 +203,22 @@ project.gradle.taskGraph.whenReady {
kover { kover {
currentProject { currentProject {
sources { sources {
excludedSourceSets.addAll(
"aot", "e2eTest", "intTest"
)
} }
} }
reports { reports {
verify {
rule {
bound{
minValue = 50
coverageUnits = CoverageUnit.INSTRUCTION
}
}
}
filters { filters {
excludes { excludes {
packages(
"dev.usbharu.hideout.activitypub.domain.exception",
"dev.usbharu.hideout.core.domain.exception",
"dev.usbharu.hideout.core.domain.exception.media",
"dev.usbharu.hideout.core.domain.exception.resource",
"dev.usbharu.hideout.core.domain.exception.resource.local"
)
annotatedBy("org.springframework.context.annotation.Configuration") annotatedBy("org.springframework.context.annotation.Configuration")
annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties") annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties")
packages( packages(
@ -252,10 +243,7 @@ licenseReport {
importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml"))) importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml")))
renderers = arrayOf<ReportRenderer>( renderers = arrayOf<ReportRenderer>(
InventoryHtmlReportRenderer(), InventoryHtmlReportRenderer(), CsvReportRenderer(), JsonReportRenderer(), XmlReportRenderer()
CsvReportRenderer(),
JsonReportRenderer(),
XmlReportRenderer()
) )
filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true)) filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true))
allowedLicensesFile = File("$projectDir/allowed-licenses.json") allowedLicensesFile = File("$projectDir/allowed-licenses.json")