forked from TinySuiteHQ/TinySearch
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (169 loc) · 5.93 KB
/
Copy pathci.yml
File metadata and controls
204 lines (169 loc) · 5.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
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
inputs:
run_live_search_tests:
description: "Run opt-in tests against the live DDGS search backend"
required: false
default: false
type: boolean
permissions:
contents: read
jobs:
core-boundary:
name: Core package boundary
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install the base package
run: |
python -m pip install --upgrade pip
python -m pip install .
- name: Verify core imports without declared server dependencies
run: |
python -c "import tinysearch; from tinysearch import TinySearchConfig, to_prompt"
python -c "import importlib.metadata as m; r=m.requires('tinysuite-search') or []; assert not any(x.lower().startswith(('fastapi','uvicorn','mcp')) and 'extra ==' not in x.lower() for x in r)"
- name: Run core contract tests
run: python -m unittest tests.test_core tests.test_public_config_and_results tests.test_research_pipeline tests.test_scrape_pipeline tests.test_grounded_prompt_service
platform-tests:
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- "3.12"
- "3.13"
- "3.14"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package with server extra
run: |
python -m pip install --upgrade pip
python -m pip install ".[server]"
- name: Run full test suite
run: python -m unittest discover tests
- name: Smoke-test MCP over stdio
run: python scripts/smoke_mcp_stdio.py
package:
name: Build and install distributions
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Check release metadata
run: python scripts/check_release_metadata.py
- name: Build wheel and source distribution
run: |
python -m pip install --upgrade pip build twine
python -m build
python -m twine check dist/*
- name: Install wheel with server extra into a fresh environment
run: |
python -m venv "${RUNNER_TEMP}/tinysearch-wheel"
WHEEL="$(find "${GITHUB_WORKSPACE}/dist" -name '*.whl' -print -quit)"
"${RUNNER_TEMP}/tinysearch-wheel/bin/python" -m pip install "${WHEEL}[server]"
- name: Verify installed wheel away from the checkout
working-directory: ${{ runner.temp }}
run: |
"${RUNNER_TEMP}/tinysearch-wheel/bin/python" -c "import importlib.metadata as m, json, os, tinysearch, tomllib; expected=tomllib.load(open(os.path.join(os.environ['GITHUB_WORKSPACE'], 'pyproject.toml'), 'rb'))['project']['version']; assert m.version('tinysuite-search') == expected; json.dumps(tinysearch.TinySearchConfig().to_dict())"
"${RUNNER_TEMP}/tinysearch-wheel/bin/python" "${GITHUB_WORKSPACE}/scripts/smoke_mcp_stdio.py"
- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/
if-no-files-found: error
live-search-tests:
name: Live DDGS search
if: ${{ github.event_name == 'workflow_dispatch' && inputs.run_live_search_tests }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install the base package
run: python -m pip install .
- name: Run live search tests
env:
TINYSEARCH_RUN_LIVE_TESTS: "1"
run: python -m unittest tests.test_live_search
docker-build:
name: Docker security and smoke test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Scan container configuration
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: config
scan-ref: Dockerfile
scanners: misconfig
format: table
severity: CRITICAL,HIGH
exit-code: "1"
trivyignores: .trivyignore.yaml
- name: Scan repository for secrets
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
scanners: secret
skip-dirs: .venv
format: table
severity: CRITICAL,HIGH
exit-code: "1"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build MCP image
uses: docker/build-push-action@v7
with:
context: .
load: true
push: false
tags: tinysearch:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Smoke-test image entrypoint
run: docker run --rm tinysearch:test tinysearch --help
- name: Scan image for vulnerabilities and secrets
uses: aquasecurity/trivy-action@v0.36.0
env:
TRIVY_IMAGE_CONFIG_SCANNERS: secret
with:
image-ref: tinysearch:test
scanners: vuln,secret
format: table
severity: CRITICAL,HIGH
exit-code: "1"
ignore-unfixed: true