-
-
Notifications
You must be signed in to change notification settings - Fork 16
274 lines (263 loc) · 9.94 KB
/
Copy pathci.yml
File metadata and controls
274 lines (263 loc) · 9.94 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
# Cancel in-progress runs on the same ref when a new commit lands.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
jobs:
# ---------------------------------------------------------------------------
# Lint (fast — runs once, on one Python version)
# ---------------------------------------------------------------------------
lint:
name: Lint (ruff check + ruff format)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install lint tools
run: pip install "ruff>=0.4"
- name: ruff check (lints)
run: ruff check multimind/
- name: ruff format --check (formatter)
run: ruff format --check multimind/
# ---------------------------------------------------------------------------
# Security scanning.
#
# bandit — static analysis of our own code. HIGH-severity findings
# fail the job (0 today). Medium/low are surfaced in the log
# but don't block (the codebase has ~190 medium findings,
# mostly B615 HuggingFace revision-pinning noise — tracked
# for a future cleanup, see SECURITY.md).
# pip-audit — dependency CVE scan. Advisory (continue-on-error) because
# several CVEs live in transitive deps without a fixed
# release yet; we still want them visible on every PR.
# ---------------------------------------------------------------------------
security:
name: Security (bandit + pip-audit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install security tools
run: pip install bandit pip-audit
- name: bandit (high-severity gate)
run: bandit -r multimind/ -lll
- name: bandit (full report — informational)
if: always()
run: bandit -r multimind/ -ll || true
- name: pip-audit (dependency CVEs — advisory)
if: always()
continue-on-error: true
run: |
pip install -e ".[dev]"
pip-audit --progress-spinner off
# ---------------------------------------------------------------------------
# Core tests across the supported Python matrix.
#
# Installs only the [dev] extra so we exercise the lazy-imports surface
# (Phase 2). Tests that require heavy extras are gated by markers and
# filtered out here, then run in dedicated jobs below.
# ---------------------------------------------------------------------------
test-core:
name: test-core (py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install core + dev
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run core tests
run: |
pytest tests/ -v \
--tb=short \
--junitxml=test-results-core.xml \
-m "not integration and not slow and not requires_api_key"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-core-py${{ matrix.python-version }}
path: test-results-core.xml
# ---------------------------------------------------------------------------
# RAG extras (faiss-cpu, chromadb, sentence-transformers, etc.)
# ---------------------------------------------------------------------------
test-rag:
name: test-rag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install rag + vector-stores + dev
run: |
python -m pip install --upgrade pip
pip install -e ".[rag,vector-stores,dev]"
- name: Run RAG-related tests
run: |
pytest tests/ -v \
--tb=short \
--junitxml=test-results-rag.xml \
-m "not integration and not slow and not requires_api_key" \
tests/test_retrieval.py \
tests/test_vector_store.py \
tests/test_document_loader.py
# ---------------------------------------------------------------------------
# Compliance extras (cryptography, plotly, dash, pandas)
# ---------------------------------------------------------------------------
test-compliance:
name: test-compliance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install compliance + dev
run: |
python -m pip install --upgrade pip
pip install -e ".[compliance,dev]"
- name: Run compliance tests
run: |
pytest tests/ -v \
--tb=short \
--junitxml=test-results-compliance.xml \
-m "not integration and not slow and not requires_api_key" \
tests/test_compliance_legacy_imports.py \
tests/test_compliance_controls.py \
tests/examples/compliance/
# ---------------------------------------------------------------------------
# Fine-tuning extras (torch, transformers, peft, datasets, optuna)
# Heavy install — limited to one Python version.
# ---------------------------------------------------------------------------
test-finetune:
name: test-finetune
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install finetune + dev (CPU torch)
run: |
python -m pip install --upgrade pip
# CPU-only torch wheel keeps the install size manageable on
# GitHub-hosted runners.
pip install "torch>=2.0.0" --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[finetune,dev]"
- name: Run fine-tuning tests
run: |
pytest -v \
--tb=short \
--junitxml=test-results-finetune.xml \
-m "not integration and not slow and not requires_api_key" \
tests/test_model_client.py \
tests/test_llm.py \
tests/test_llm_wrappers.py
# ---------------------------------------------------------------------------
# Gateway / API server extras (fastapi, uvicorn, redis, jose)
# ---------------------------------------------------------------------------
test-gateway:
name: test-gateway
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install gateway + dev
run: |
python -m pip install --upgrade pip
pip install -e ".[gateway,dev]"
- name: Run gateway tests
run: |
pytest tests/ -v \
--tb=short \
--junitxml=test-results-gateway.xml \
-m "not integration and not slow and not requires_api_key" \
-k "gateway or api or mcp"
# ---------------------------------------------------------------------------
# Full suite with everything installed, including the framework-interop
# extras (langchain-core, llama-index-core) and the MCP SDK (already part
# of `all`). This is the only job where tests that `importorskip` those
# packages actually execute instead of skipping. Acts as the historical
# "must reach 95% pass rate" gate.
# ---------------------------------------------------------------------------
test-full:
name: test-full (coverage + 95% gate)
runs-on: ubuntu-latest
needs: [test-core]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- name: Install all extras + dev
run: |
python -m pip install --upgrade pip
pip install "torch>=2.0.0" --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[all,dev,langchain,llamaindex]"
- name: Run full suite with coverage
run: |
pytest tests/ \
--cov=multimind \
--cov-report=term-missing \
--cov-report=xml \
--cov-fail-under=20 \
--junitxml=test-results-full.xml \
-v --tb=short \
| tee pytest-summary.txt
- name: Enforce 95% pass-rate threshold
run: |
python - <<'PY'
import re, sys
with open("pytest-summary.txt") as f:
out = f.read()
passed = int((re.search(r"(\d+) passed", out) or [0,"0"])[1])
failed = int((re.search(r"(\d+) failed", out) or [0,"0"])[1])
skipped = int((re.search(r"(\d+) skipped", out) or [0,"0"])[1])
total = passed + failed + skipped
rate = (passed / total * 100) if total else 0.0
print(f"Results: {passed} passed, {failed} failed, {skipped} skipped")
print(f"Pass rate: {rate:.1f}%")
if rate < 95.0:
sys.exit(f"FAIL: pass rate {rate:.1f}% < 95%")
print("PASS: meets 95% threshold")
PY
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage-xml
path: coverage.xml
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-full
path: test-results-full.xml