Skip to content

Commit

Permalink
Add kover project
Browse files Browse the repository at this point in the history
  • Loading branch information
turchenkoalex committed Jul 16, 2024
1 parent 024c7bc commit a52b887
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 71 deletions.
45 changes: 13 additions & 32 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
permissions:
contents: read
checks: write
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -27,12 +28,23 @@ jobs:
java-version: '${{ env.JDK_VERSION }}'
cache: 'gradle'
- name: Build and Run Tests
run: ./gradlew test
run: ./gradlew test koverXmlReport
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Publish Kover Report
uses: madrapps/[email protected]
if: success() || failure() # always run even if the previous step fails
with:
paths: |
${{ github.workspace }}/build/reports/kover/report.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 50
min-coverage-changed-files: 60
- name: Coverage verify
run: ./gradlew koverVerify
detekt:
name: Detekt
runs-on: ubuntu-latest
Expand All @@ -59,34 +71,3 @@ jobs:
if: success() || failure() # always run even if the previous step fails
with:
path: 'build/reports/detekt/merge.xml'
coverage:
name: Coverage
runs-on: ubuntu-latest
permissions:
# required for all workflows
pull-requests: write
# only required for workflows in private repositories
actions: read
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '${{ env.JDK_VERSION }}'
cache: 'gradle'
- name: Run Kover
run: ./gradlew koverXmlReport
- name: Publish Kover Report
uses: madrapps/[email protected]
if: success() || failure() # always run even if the previous step fails
with:
paths: |
${{ github.workspace }}/build/reports/kover/report.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 50
min-coverage-changed-files: 60
- name: Run Kover Verify
run: ./gradlew koverVerify
54 changes: 15 additions & 39 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,53 +52,29 @@ subprojects {
}
}

// Kover - coverage

val excludedProjects = listOf(
":benchmarks",
":mocks",
":sample",
val coverageExclusions = setOf(
"benchmarks",
"mocks",
"sample",
)

subprojects {
apply(plugin = "org.jetbrains.kotlinx.kover")

kover {
reports {
filters {
excludes {
projects.addAll(excludedProjects)
}
}
if (this.name !in coverageExclusions) {
apply(plugin = "org.jetbrains.kotlinx.kover")

verify {
rule {
minBound(50)
}
}
// register kover for generating merged report from all subprojects
rootProject.dependencies {
kover(project)
}
}
}

// Total kover rules
kover {
reports {
total {
verify {
rule {
minBound(50)
kover {
reports {
verify {
rule("Minimal line coverage rate in percents") {
minBound(50)
}
}
}
}
}
}

dependencies {
kover(project(":core"))
kover(project(":cors"))
kover(project(":json"))
kover(project(":jwt"))
kover(project(":metrics"))
kover(project(":tracing"))
kover(project(":typesafe"))
}

0 comments on commit a52b887

Please sign in to comment.