-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (55 loc) · 2.03 KB
/
generate-and-test.yml
File metadata and controls
68 lines (55 loc) · 2.03 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
name: Generate and Test OpenAPI MCP Server
on:
push:
branches:
- main
pull_request:
jobs:
generate-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install package (editable mode)
run: |
pip install -e .
- name: Run generator script
run: |
mkdir -p tests/out/
python generator.py \
tests/openapi.yaml \
--output-dir ./tests/out/ \
--api-url http://localhost:8000/api \
--api-token "test-token"
- name: Run generator via CLI tool
run: |
mkdir -p tests/out_cli/
mcp-generator tests/openapi.yaml --output-dir ./tests/out_cli/ --api-url http://localhost:8000/api --api-token "test-token"
- name: Run generator via Python module
run: |
mkdir -p tests/out_module/
python -m openapi_mcp_generator.cli tests/openapi.yaml --output-dir ./tests/out_module/ --api-url http://localhost:8000/api --api-token "test-token"
- name: Verify output directory exists
run: |
ls ./tests/out/ | grep "openapi-mcp-reference-test-api-"
shell: bash
- name: Verify generated mcp_server.py
run: |
GENERATED_DIR=$(ls ./tests/out/ | grep "openapi-mcp-reference-test-api-" | head -n 1)
grep -q "async def getItems(id: int, verbose: bool, limit: int, ctx: Context) -> str:" ./tests/out/$GENERATED_DIR/mcp_server.py
grep -q "def get_BadRequestDetails_schema" ./tests/out/$GENERATED_DIR/mcp_server.py
shell: bash
- name: Install pytest
run: |
pip install pytest
- name: Run tests on generated server output
run: |
pytest tests/test_generated_server.py