Skip to content

Commit c368812

Browse files
authored
ci: add Codecov coverage upload and XML report generation (#579)
## Add Codecov coverage upload and XML report generation - Add `koverXmlReport` to Gradle tasks in Ubuntu workflow - Configure Codecov action to upload coverage reports Reports will be available on https://app.codecov.io/gh/modelcontextprotocol/kotlin-sdk ## Motivation and Context To provide better test coverage visibility ## How Has This Been Tested? CI ## Breaking Changes No ## Types of changes - [x] CI update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] 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 45fcc17 commit c368812

3 files changed

Lines changed: 72 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
include:
3737
- os: ubuntu-latest
3838
job-name: "Linux Tests"
39-
gradle-tasks: "build ktlintCheck koverLog koverHtmlReport publishToMavenLocal -Pversion=1-SNAPSHOT"
39+
gradle-tasks: "build ktlintCheck koverLog koverHtmlReport koverXmlReport publishToMavenLocal -Pversion=1-SNAPSHOT"
4040
max-workers: 3
4141

4242
- os: windows-latest
@@ -107,6 +107,24 @@ jobs:
107107
report_paths: '**/test-results/**/TEST-*.xml'
108108
truncate_stack_traces: false
109109

110+
- name: Upload coverage reports to Codecov
111+
if: matrix.os == 'ubuntu-latest'
112+
uses: codecov/codecov-action@v5
113+
with:
114+
directory: ./build/reports/kover
115+
files: report.xml
116+
117+
- name: Upload coverage reports to Codecov
118+
if: ${{ !cancelled() && matrix.os == 'ubuntu-latest' }}
119+
uses: codecov/codecov-action@v5
120+
with:
121+
directory: ./build/reports/kover
122+
files: report.xml
123+
124+
- name: Upload test results to Codecov
125+
if: ${{ !cancelled() && matrix.os == 'ubuntu-latest' }}
126+
uses: codecov/test-results-action@v1
127+
110128
- name: Archive Maven Local Repository
111129
if: ${{ success() && matrix.os == 'ubuntu-latest' }}
112130
run: |

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
[![Maven Central](https://img.shields.io/maven-central/v/io.modelcontextprotocol/kotlin-sdk.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/io.modelcontextprotocol/kotlin-sdk)
44
[![Build](https://github.com/modelcontextprotocol/kotlin-sdk/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/modelcontextprotocol/kotlin-sdk/actions/workflows/build.yml)
55
[![Conformance Tests](https://github.com/modelcontextprotocol/kotlin-sdk/actions/workflows/conformance.yml/badge.svg)](https://github.com/modelcontextprotocol/kotlin-sdk/actions/workflows/conformance.yml)
6+
[![codecov](https://codecov.io/github/modelcontextprotocol/kotlin-sdk/graph/badge.svg?token=O2CFHNSFYM)](https://codecov.io/github/modelcontextprotocol/kotlin-sdk)
7+
68
[![Kotlin](https://img.shields.io/badge/kotlin-2.2+-blueviolet.svg?logo=kotlin)](http://kotlinlang.org)
79
[![Kotlin Multiplatform](https://img.shields.io/badge/Platforms-%20JVM%20%7C%20Wasm%2FJS%20%7C%20Native%20-blueviolet?logo=kotlin)](https://kotlinlang.org/docs/multiplatform.html)
810
[![JVM](https://img.shields.io/badge/JVM-11+-red.svg?logo=jvm)](http://java.com)

codecov.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Codecov configuration for Mokksy and AI-Mocks
2+
# https://docs.codecov.com/docs/codecov-yaml
3+
4+
codecov:
5+
require_ci_to_pass: yes
6+
7+
coverage:
8+
precision: 2
9+
round: down
10+
status:
11+
project:
12+
default:
13+
target: auto
14+
threshold: 1%
15+
patch:
16+
default:
17+
target: auto
18+
threshold: 1%
19+
20+
comment:
21+
layout: "header, diff, flags, components"
22+
behavior: default
23+
require_changes: true
24+
25+
component_management:
26+
default_rules:
27+
statuses:
28+
- type: project
29+
target: auto
30+
individual_components:
31+
32+
- component_id: kotlin-sdk-core
33+
name: SDK Core
34+
paths:
35+
- kotlin-sdk-core/**
36+
37+
- component_id: kotlin-sdk-client
38+
name: SDK Client
39+
paths:
40+
- kotlin-sdk-client/**
41+
42+
- component_id: kotlin-sdk-server
43+
name: SDK Server
44+
paths:
45+
- kotlin-sdk-server/**
46+
47+
- component_id: kotlin-sdk-testing
48+
name: SDK Testing
49+
paths:
50+
- kotlin-sdk-testing/**
51+

0 commit comments

Comments
 (0)