-
Notifications
You must be signed in to change notification settings - Fork 0
215 lines (201 loc) · 6.93 KB
/
ci.yml
File metadata and controls
215 lines (201 loc) · 6.93 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -e ".[dev]"
- run: ruff check src/ tests/
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev,monitoring]"
- run: pytest tests/ -v --ignore=tests/test_mcp_integration.py --cov=matlab_mcp --cov-report=xml --cov-report=term-missing
- uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
with:
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
security:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -e ".[dev,monitoring]"
- run: pip-audit
continue-on-error: true
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install build twine
- run: python -m build
- run: twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
test-windows:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-latest]
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev,monitoring]"
- name: Verify all modules load
run: |
python -c "from matlab_mcp.server import main; print('OK: server')"
python -c "from matlab_mcp.auth.middleware import BearerAuthMiddleware; print('OK: auth')"
python -c "from matlab_mcp.hitl.gate import request_execute_approval; print('OK: hitl')"
python -c "from matlab_mcp.config import HITLConfig; print('OK: HITLConfig')"
- name: Run tests (no MATLAB engine)
run: pytest tests/ -v -k "not matlab" --ignore=tests/test_integration.py --ignore=tests/test_mcp_integration.py -W ignore::pytest.PytestUnraisableExceptionWarning
test-windows-install-bat:
needs: lint
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run install.bat (real user install path)
shell: cmd
run: call install.bat < nul
- name: Verify install.bat produced working install
shell: cmd
run: |
call .venv\Scripts\activate.bat
python -c "from matlab_mcp.server import main; print('OK: server module loads')"
test-macos:
needs: lint
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev,monitoring]"
- run: pytest tests/ -v -k "not matlab" --ignore=tests/test_mcp_integration.py -W ignore::pytest.PytestUnraisableExceptionWarning
conda-test-dev:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: matlab-mcp-dev
environment-file: environment-dev.yml
auto-activate-base: false
python-version: "3.12"
- name: Verify all modules load
shell: bash -el {0}
run: |
python -c "from matlab_mcp.server import main; print('OK: server')"
python -c "from matlab_mcp.auth.middleware import BearerAuthMiddleware; print('OK: auth')"
python -c "from matlab_mcp.hitl.gate import request_execute_approval; print('OK: hitl')"
- name: Run unit tests
shell: bash -el {0}
run: pytest tests/ -v -k "not matlab" --ignore=tests/test_integration.py --ignore=tests/test_mcp_integration.py -W ignore::pytest.PytestUnraisableExceptionWarning
conda-test-pypi:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: matlab-mcp
environment-file: environment.yml
auto-activate-base: false
python-version: "3.12"
- name: Verify server loads (PyPI install)
shell: bash -el {0}
run: |
python -c "from matlab_mcp.server import main; print('OK: server')"
python -c "from matlab_mcp.config import AppConfig; print('OK: config')"
matlab-mcp --help
integration-test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -e ".[dev,monitoring]" pytest-timeout
- run: pytest tests/test_mcp_integration.py -v -m integration --timeout=60
integration-test-windows:
needs: lint
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -e ".[dev,monitoring]" pytest-timeout
- run: pytest tests/test_mcp_integration.py -v -m integration --timeout=60
remote-integration-test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker compose -f docker-compose.test.yml up --build --exit-code-from client
- name: Cleanup
if: always()
run: docker compose -f docker-compose.test.yml down -v
docker:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t matlab-mcp:test .
- name: Smoke-test container health endpoint
run: |
docker run -d --name mcp-test \
-e MATLAB_MCP_SERVER_TRANSPORT=sse \
-e MATLAB_MCP_MONITORING_ENABLED=true \
-p 8765:8765 \
matlab-mcp:test
# The server will crash on pool start (no MATLAB engine in CI).
# curl will fail; || true prevents the step from failing.
# Goal: verify the image builds and the ENTRYPOINT is valid.
sleep 5
curl --retry 5 --retry-delay 2 --retry-connrefused \
http://localhost:8765/health || true
docker logs mcp-test
docker stop mcp-test || true
docker rm mcp-test || true