-
Notifications
You must be signed in to change notification settings - Fork 7
82 lines (67 loc) · 2.77 KB
/
generate-and-test.yml
File metadata and controls
82 lines (67 loc) · 2.77 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
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 (OpenAPI YAML)
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 script (JSON specifications)
run: |
python generator.py \
tests/test_fixtures/ \
--output-dir ./tests/out/ \
--api-url http://localhost:8000/api \
--api-token "test-token"
- name: Run generator via CLI tool (OpenAPI YAML)
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 CLI tool (JSON specifications)
run: |
mcp-generator tests/test_fixtures/ --output-dir ./tests/out_cli/ --api-url http://localhost:8000/api --api-token "test-token"
- name: Run generator via Python module (OpenAPI YAML)
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: Run generator via Python module (JSON specifications)
run: |
python -m openapi_mcp_generator.cli tests/test_fixtures/ --output-dir ./tests/out_module/ --api-url http://localhost:8000/api --api-token "test-token"
- name: Verify output directories exist
run: |
echo "Checking tests/out/ directory:"
ls ./tests/out/ | grep -E "(openapi-mcp-reference-test-api-|openapi-mcp-generated-api-)"
echo "Checking tests/out_cli/ directory:"
ls ./tests/out_cli/ | grep -E "(openapi-mcp-reference-test-api-|openapi-mcp-generated-api-)"
echo "Checking tests/out_module/ directory:"
ls ./tests/out_module/ | grep -E "(openapi-mcp-reference-test-api-|openapi-mcp-generated-api-)"
shell: bash
- name: Install pytest
run: |
pip install pytest
- name: Run tests on generated server output
run: |
pytest tests/test_generated_server.py