Compare commits

..

No commits in common. "884d17cf471e609eaf1e3967e954727e8c0c73d3" and "75a59d739301643c769587a1dff902296cf91131" have entirely different histories.

2 changed files with 54 additions and 44 deletions

View File

@ -85,17 +85,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
title: Code Coverage title: Code Coverage
update-comment: true update-comment: true
min-coverage-overall: 50 min-coverage-overall: 80
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,7 +19,6 @@ 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 {
@ -38,6 +37,19 @@ 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 {
@ -73,7 +85,8 @@ repositories {
} }
val os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem() val os = org.gradle.nativeplatform.platform.internal
.DefaultNativePlatform.getCurrentOperatingSystem()
dependencies { dependencies {
developmentOnly(libs.h2db) developmentOnly(libs.h2db)
@ -160,40 +173,35 @@ configurations {
} }
} }
tasks {
withType<io.gitlab.arturbosch.detekt.Detekt> { //tasks{
// 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
@ -203,22 +211,23 @@ 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(
@ -243,7 +252,10 @@ 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(), CsvReportRenderer(), JsonReportRenderer(), XmlReportRenderer() InventoryHtmlReportRenderer(),
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")