Skip to content

Commit 4dc0cad

Browse files
authored
Ci/coverage badge (#191)
* ci: coverage badge
1 parent 35282ee commit 4dc0cad

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ on:
55
branches: [ main, release ]
66
tags:
77
- 'release-*'
8+
paths-ignore:
9+
- "**/coverage.svg"
810
pull_request:
911
branches: [ main, release ]
12+
paths-ignore:
13+
- "**/coverage.svg"
1014

1115
env:
1216
CARGO_TERM_COLOR: always
@@ -101,6 +105,8 @@ jobs:
101105
coverage:
102106
name: Code Coverage
103107
runs-on: ubuntu-latest
108+
permissions:
109+
contents: write
104110
steps:
105111
- uses: actions/checkout@v3
106112

@@ -130,8 +136,19 @@ jobs:
130136
- name: Install llvm-tools-preview
131137
run: rustup component add llvm-tools-preview
132138

139+
- name: Install lcov
140+
run: sudo apt-get update && sudo apt-get install -y lcov bc
141+
133142
- name: Run tests with coverage
134-
run: cargo llvm-cov --all-features
143+
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
144+
145+
- name: Generate coverage badge
146+
if: github.ref == 'refs/heads/main'
147+
uses: GoogleCloudPlatform/lcov-coverage-badge@5857899449990297b622767f36e4fa8d1218acdb
148+
with:
149+
file: ./lcov.info
150+
icon_name: github
151+
access_token: ${{ secrets.GITHUB_TOKEN }}
135152

136153
security_audit:
137154
name: Security Audit

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Crates.io Version](https://img.shields.io/crates/v/rmcp)](https://crates.io/crates/rmcp)
88
![Release status](https://github.com/modelcontextprotocol/rust-sdk/actions/workflows/release.yml/badge.svg)
99
[![docs.rs](https://img.shields.io/docsrs/rmcp)](https://docs.rs/rmcp/latest/rmcp)
10+
![Coverage](coverage.svg)
1011

1112
An official rust Model Context Protocol SDK implementation with tokio async runtime.
1213

0 commit comments

Comments
 (0)