-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
91 lines (85 loc) · 2.57 KB
/
action.yml
File metadata and controls
91 lines (85 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: 'pytest-mcp-plugin'
description: 'pytest for MCP servers — run your MCP test suite on every PR.'
author: 'yagna-1'
branding:
icon: 'check-circle'
color: 'green'
inputs:
command:
description: 'Command to start the MCP server (e.g. "python my_server.py").'
required: true
test-dir:
description: 'Directory containing pytest tests.'
required: false
default: 'tests'
python-version:
description: 'Python version to install.'
required: false
default: '3.12'
timeout:
description: 'Per-request timeout in seconds.'
required: false
default: '10'
extras:
description: 'pytest-mcp-plugin extras to install (comma-separated). Empty for none, "all" for http+schema.'
required: false
default: 'all'
mcptest-version:
description: 'pytest-mcp-plugin version to install (e.g. "0.2.0"). Empty for latest.'
required: false
default: ''
pytest-args:
description: 'Extra arguments to pass to pytest.'
required: false
default: '-v'
junit-xml:
description: 'Path to write a JUnit XML report. Empty to skip.'
required: false
default: 'mcptest-results.xml'
outputs:
junit-xml:
description: 'Path to the JUnit XML report (if generated).'
value: ${{ inputs.junit-xml }}
runs:
using: 'composite'
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install pytest-mcp-plugin
shell: bash
run: |
set -euo pipefail
pkg="pytest-mcp-plugin"
if [ -n "${{ inputs.extras }}" ]; then
pkg="${pkg}[${{ inputs.extras }}]"
fi
if [ -n "${{ inputs.mcptest-version }}" ]; then
pkg="${pkg}==${{ inputs.mcptest-version }}"
fi
python -m pip install --upgrade pip
python -m pip install "${pkg}"
mcp-test --version
- name: Run pytest-mcp-plugin
shell: bash
run: |
set -euo pipefail
args=(
"${{ inputs.test-dir }}"
"--mcp-command=${{ inputs.command }}"
"--mcp-timeout=${{ inputs.timeout }}"
)
if [ -n "${{ inputs.junit-xml }}" ]; then
args+=("--junitxml=${{ inputs.junit-xml }}")
fi
# shellcheck disable=SC2206
extra=( ${{ inputs.pytest-args }} )
python -m pytest "${args[@]}" "${extra[@]}"
- name: Upload JUnit report
if: always() && inputs.junit-xml != ''
uses: actions/upload-artifact@v4
with:
name: mcptest-results
path: ${{ inputs.junit-xml }}
if-no-files-found: ignore