Skip to content

Commit 015abbc

Browse files
author
Suresh Kumar Moharajan
committed
Merge branch 'bugfix/admin-edit-prompt-json-500' of github.com:IBM/mcp-context-forge into bugfix/admin-edit-prompt-json-500
2 parents c6288a7 + 55465a8 commit 015abbc

File tree

108 files changed

+12315
-3224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+12315
-3224
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# All files in the repo
22
* @crivetimihai
33

4+
# Plugin framework
5+
/mcpgateway/plugins @araujof @terylt @jonpspri
6+
47
# Ownership for all tests
58
/tests/ @crivetimihai @kevalmahajan @madhav165
9+
10+
# Tests for plugin framework
11+
/tests/unit/mcpgateway/plugins @araujof @terylt @jonpspri

.github/workflows/license-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ jobs:
4848
- name: Install go-licenses
4949
run: go install github.com/google/go-licenses@latest
5050

51-
- uses: dtolnay/rust-toolchain@stable
51+
- name: Install Rust stable
52+
run: rustup default stable
5253

5354
- name: Install cargo-license
5455
run: cargo install cargo-license

.github/workflows/pytest.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ jobs:
8383
version: "0.9.2"
8484
python-version: ${{ matrix.python }}
8585

86+
# -----------------------------------------------------------
87+
# 2.5 Setup Rust toolchain for Rust plugins
88+
# -----------------------------------------------------------
89+
- name: 🦀 Install Rust stable
90+
run: rustup default stable
91+
92+
- name: 📦 Cache Cargo dependencies
93+
uses: actions/cache@v4
94+
with:
95+
path: |
96+
~/.cargo/registry
97+
~/.cargo/git
98+
plugins_rust/*/target
99+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
100+
restore-keys: |
101+
${{ runner.os }}-cargo-
102+
103+
- name: 🔨 Build Rust plugins (clean, install, verify stubs)
104+
run: make rust-clean-stubs && make rust-install && make rust-verify-stubs
105+
86106
# -----------------------------------------------------------
87107
# 3️⃣ Run the tests with coverage (fail under 95% coverage)
88108
# -----------------------------------------------------------
@@ -98,6 +118,8 @@ jobs:
98118
--cov-report=term \
99119
--cov-branch \
100120
--cov-fail-under=95
121+
env:
122+
REQUIRE_RUST: "1"
101123

102124
# -----------------------------------------------------------
103125
# 3.5 Diff-cover: enforce 95% coverage on changed lines (PRs only)

.github/workflows/rust-plugins.yml

Lines changed: 79 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ concurrency:
2424
cancel-in-progress: true
2525

2626
jobs:
27-
# Rust unit tests and linting
27+
# Rust unit tests and linting (all plugins in one job per OS)
2828
rust-tests:
2929
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
3030
name: Rust Tests (${{ matrix.os }})
@@ -34,7 +34,6 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
37-
rust: [stable]
3837

3938
steps:
4039
- uses: actions/checkout@v4
@@ -60,26 +59,17 @@ jobs:
6059
- name: Cache Cargo build
6160
uses: actions/cache@v4
6261
with:
63-
path: plugins_rust/target
62+
path: plugins_rust/*/target
6463
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
6564

66-
- name: Check formatting
67-
working-directory: plugins_rust
68-
run: make fmt-check
65+
# rust-check = fmt-check + clippy + cargo test only
66+
- name: Run all checks for plugins
67+
run: make rust-check
6968

70-
- name: Run Clippy
71-
working-directory: plugins_rust
72-
run: make clippy
73-
74-
- name: Run Rust tests
75-
working-directory: plugins_rust
76-
run: make test-verbose
77-
78-
79-
# Build wheels for multiple platforms (native builds)
69+
# Build wheels for multiple platforms (all plugins in one job per OS)
8070
build-wheels:
8171
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
82-
name: Build wheels on ${{ matrix.os }}
72+
name: Build wheels (${{ matrix.os }})
8373
runs-on: ${{ matrix.os }}
8474
timeout-minutes: 60
8575
strategy:
@@ -98,75 +88,46 @@ jobs:
9888
- name: Install Rust stable
9989
run: rustup default stable
10090

101-
- name: Install maturin
102-
run: pip install maturin
91+
- name: Install uv
92+
uses: astral-sh/setup-uv@v5
93+
with:
94+
version: "0.9.2"
95+
96+
- name: Install maturin as CLI tool
97+
run: uv tool install maturin
10398

104-
- name: Build wheels
105-
working-directory: plugins_rust
106-
run: maturin build --release --out dist
99+
- name: Build wheels for all plugins
100+
run: make rust-build-wheels
107101

108102
- name: Upload wheels as artifacts
109103
uses: actions/upload-artifact@v4
110104
with:
111-
name: wheels-${{ matrix.os }}
112-
path: plugins_rust/dist/*.whl
105+
name: wheels-build
106+
path: plugins_rust/*/dist/*.whl
113107

114-
115-
# Python integration tests with Rust extensions
116-
python-integration:
108+
# Security audit (all plugins in one job)
109+
security-audit:
117110
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
118-
name: Python Integration Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
119-
runs-on: ${{ matrix.os }}
111+
name: Security Audit
112+
runs-on: ubuntu-latest
120113
timeout-minutes: 60
121-
needs: build-wheels
122-
strategy:
123-
fail-fast: false
124-
matrix:
125-
os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
126-
python-version: ["3.12"]
127114

128115
steps:
129116
- uses: actions/checkout@v4
130117

131-
- name: Set up Python ${{ matrix.python-version }}
132-
uses: actions/setup-python@v5
133-
with:
134-
python-version: ${{ matrix.python-version }}
135-
136118
- name: Install Rust stable
137119
run: rustup default stable
138120

139-
- name: Install uv
140-
uses: astral-sh/setup-uv@v5
141-
with:
142-
version: "0.9.2"
143-
144-
- name: Install maturin as CLI tool
145-
run: uv tool install maturin
146-
147-
- name: Create virtual environment
148-
run: uv venv
149-
150-
- name: Install dependencies
151-
run: |
152-
uv pip install pytest pytest-cov pydantic
153-
154-
- name: Build and install Rust extension
155-
working-directory: plugins_rust
156-
run: make dev
157-
158-
- name: Run Python unit tests (Rust)
159-
working-directory: plugins_rust
160-
run: uv run make test-python
121+
- name: Install cargo-audit
122+
run: cargo install cargo-audit
161123

162-
- name: Run differential tests
163-
working-directory: plugins_rust
164-
run: uv run make test-differential
124+
- name: Run security audit on all plugins
125+
run: make rust-audit
165126

166-
# Security audit
167-
security-audit:
127+
# Benchmark tests (verify benchmarks compile and run)
128+
benchmark-tests:
168129
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
169-
name: Security Audit
130+
name: Benchmark Tests
170131
runs-on: ubuntu-latest
171132
timeout-minutes: 60
172133

@@ -176,14 +137,28 @@ jobs:
176137
- name: Install Rust stable
177138
run: rustup default stable
178139

179-
- name: Install cargo-audit
180-
run: cargo install cargo-audit
140+
- name: Cache Cargo registry
141+
uses: actions/cache@v4
142+
with:
143+
path: ~/.cargo/registry
144+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
145+
146+
- name: Cache Cargo index
147+
uses: actions/cache@v4
148+
with:
149+
path: ~/.cargo/git
150+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
151+
152+
- name: Cache Cargo build
153+
uses: actions/cache@v4
154+
with:
155+
path: plugins_rust/*/target
156+
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
181157

182-
- name: Run security audit
183-
working-directory: plugins_rust
184-
run: make audit
158+
- name: Run benchmarks for all plugins
159+
run: make rust-bench
185160

186-
# Coverage report
161+
# Coverage report (all plugins in one job)
187162
coverage:
188163
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
189164
name: Code Coverage
@@ -217,24 +192,19 @@ jobs:
217192
- name: Install coverage tools
218193
run: |
219194
uv pip install pytest pytest-cov pydantic
220-
cargo install cargo-tarpaulin
195+
cargo install cargo-llvm-cov
221196
222-
- name: Build Rust extension
223-
working-directory: plugins_rust
224-
run: make dev
225-
226-
- name: Run coverage
227-
working-directory: plugins_rust
228-
run: uv run make coverage
197+
- name: Run coverage for all plugins
198+
run: make rust-coverage
229199

230200
- name: Upload coverage to Codecov
231201
uses: codecov/codecov-action@v4
232202
with:
233-
files: ./plugins_rust/coverage/cobertura.xml
234-
flags: rust
235-
name: rust-coverage
203+
files: ./plugins_rust/*/coverage/cobertura.xml
204+
flags: rust-plugins
205+
name: rust-plugins-coverage
236206

237-
# Build documentation
207+
# Build documentation (all plugins in one job)
238208
documentation:
239209
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
240210
name: Build Documentation
@@ -247,24 +217,24 @@ jobs:
247217
- name: Install Rust stable
248218
run: rustup default stable
249219

250-
- name: Build Rust docs
251-
working-directory: plugins_rust
252-
run: make doc
220+
- name: Build Rust docs for all plugins
221+
run: make rust-doc
253222

254223
- name: Upload documentation
255224
uses: actions/upload-artifact@v4
256225
with:
257226
name: rust-docs
258-
path: plugins_rust/target/doc
227+
path: plugins_rust/*/target/doc
259228

260-
# Release build (only on tags)
229+
# Release build (only on tags, all plugins per OS)
261230
release:
262-
name: Release Build
231+
name: Release Build (${{ matrix.os }})
263232
runs-on: ${{ matrix.os }}
264233
timeout-minutes: 60
265234
if: startsWith(github.ref, 'refs/tags/')
266-
needs: [rust-tests, python-integration]
235+
needs: rust-tests
267236
strategy:
237+
fail-fast: false
268238
matrix:
269239
os: [ubuntu-latest, macos-latest, windows-latest]
270240

@@ -279,22 +249,25 @@ jobs:
279249
- name: Install Rust stable
280250
run: rustup default stable
281251

282-
- name: Install maturin
283-
run: pip install maturin
252+
- name: Install uv
253+
uses: astral-sh/setup-uv@v5
254+
with:
255+
version: "0.9.2"
256+
257+
- name: Install maturin as CLI tool
258+
run: uv tool install maturin
284259

285-
- name: Build release wheels
286-
working-directory: plugins_rust
287-
run: maturin build --release --out dist
260+
- name: Build and publish release wheels
261+
env:
262+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
263+
run: |
264+
make rust-release
265+
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
266+
make rust-release-publish
267+
fi
288268
289269
- name: Upload release artifacts
290270
uses: actions/upload-artifact@v4
291271
with:
292272
name: release-wheels-${{ matrix.os }}
293-
path: plugins_rust/dist/*.whl
294-
295-
- name: Publish to PyPI (if tag)
296-
if: startsWith(github.ref, 'refs/tags/')
297-
env:
298-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
299-
working-directory: plugins_rust
300-
run: maturin publish --username __token__ --password $MATURIN_PYPI_TOKEN
273+
path: plugins_rust/*/dist/*.whl

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ uv.lock
258258
# Rust (plugins_rust)
259259
# ========================================
260260
plugins_rust/target/
261+
plugins_rust/*/target/
261262
*.rs.bk
262263
plugins_rust/Cargo.lock
263264

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ repos:
305305
types: [xml]
306306

307307
- id: fix-byte-order-marker
308-
name: Fix Byte Order Marker
309-
description: Removes UTF-8 byte-order marker.
308+
name: Check Byte Order Marker
309+
description: Forbids files which have a UTF-8 byte-order marker.
310310
types: [text]
311311

312312
- repo: https://github.com/adrienverge/yamllint

.pre-commit-lite.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ repos:
309309
types: [xml]
310310

311311
- id: fix-byte-order-marker
312-
name: Fix Byte Order Marker
313-
description: Removes UTF-8 byte-order marker.
312+
name: Check Byte Order Marker
313+
description: Forbids files which have a UTF-8 byte-order marker.
314314
types: [text]
315315

316316
- repo: https://github.com/adrienverge/yamllint

0 commit comments

Comments
 (0)