Skip to content

Commit 6b5f7a7

Browse files
authored
Add Kover check (#250)
## Motivation and Context Make sure, that code is properly tested ## How Has This Been Tested? Run `./gradlew clean ktlintCheck build koverVerify koverLog koverHtmlReport` on CI ## Changes - Integrate Kover plugin for code coverage analysis - Publish Html report - Run `./gradlew clean ktlintCheck build koverVerify koverLog koverHtmlReport` on CI ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [x] Build tooling update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [ ] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [ ] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions -->
1 parent bbc7a8f commit 6b5f7a7

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: macos-latest
1818
name: Validate PR
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v5
2121

2222
- name: Set up JDK 21
2323
uses: actions/setup-java@v5
@@ -32,14 +32,16 @@ jobs:
3232
cache-read-only: true
3333

3434
- name: Build with Gradle
35-
run: ./gradlew clean build
35+
run: ./gradlew clean ktlintCheck build koverLog koverHtmlReport
3636

37-
- name: Upload JUnit test results
37+
- name: Upload Reports
3838
if: always()
3939
uses: actions/upload-artifact@v4
4040
with:
4141
name: junit-results
42-
path: '**/build/test-results/test/*.xml'
42+
path: |
43+
**/build/test-results/test/*.xml
44+
build/reports
4345
4446
- name: Disable Auto-Merge on Fail
4547
if: failure() && github.event_name == 'pull_request'

build.gradle.kts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
11
plugins {
22
alias(libs.plugins.ktlint)
3+
alias(libs.plugins.kover)
34
}
45

56
allprojects {
67
group = "io.modelcontextprotocol"
78
version = "0.6.0"
89
}
910

11+
dependencies {
12+
kover(project(":kotlin-sdk-core"))
13+
kover(project(":kotlin-sdk-client"))
14+
kover(project(":kotlin-sdk-server"))
15+
kover(project(":kotlin-sdk-test"))
16+
}
17+
1018
subprojects {
1119
apply(plugin = "org.jlleitschuh.gradle.ktlint")
20+
apply(plugin = "org.jetbrains.kotlinx.kover")
21+
}
22+
23+
kover {
24+
reports {
25+
filters {
26+
includes.classes("io.modelcontextprotocol.kotlin.sdk.*")
27+
}
28+
total {
29+
log {
30+
}
31+
verify {
32+
rule {
33+
minBound(65)
34+
}
35+
}
36+
}
37+
}
1238
}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ kotlin = "2.2.0"
44
dokka = "2.0.0"
55
atomicfu = "0.29.0"
66
ktlint = "13.0.0"
7+
kover = "0.9.1"
78

89
# libraries version
910
serialization = "1.9.0"
@@ -59,6 +60,7 @@ ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serializatio
5960
[plugins]
6061
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatibilityValidatorPlugin" }
6162
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
63+
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
6264

6365
# Samples
6466
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

0 commit comments

Comments
 (0)