-
Notifications
You must be signed in to change notification settings - Fork 8
232 lines (189 loc) · 6.55 KB
/
docs.yml
File metadata and controls
232 lines (189 loc) · 6.55 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
name: Documentation
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
validate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install markdown-it-py[linkify,plugins] linkchecker
- name: Validate Markdown syntax
run: |
python -c "
import markdown_it
import sys
from pathlib import Path
md = markdown_it.MarkdownIt()
errors = []
for md_file in Path('.').glob('*.md'):
try:
with open(md_file, 'r', encoding='utf-8') as f:
content = f.read()
md.parse(content)
print(f'✅ {md_file} - Valid Markdown')
except Exception as e:
errors.append(f'❌ {md_file} - {e}')
print(f'❌ {md_file} - {e}')
if errors:
print(f'\nFound {len(errors)} Markdown errors')
sys.exit(1)
else:
print(f'\n✅ All Markdown files are valid')
"
- name: Check documentation completeness
run: |
python -c "
import sys
from pathlib import Path
required_files = [
'README.md',
'LICENSE',
'CHANGELOG.md',
'CONTRIBUTING.md',
'SECURITY.md'
]
missing = []
for file in required_files:
if not Path(file).exists():
missing.append(file)
if missing:
print(f'❌ Missing required documentation files: {missing}')
sys.exit(1)
else:
print('✅ All required documentation files present')
"
- name: Validate links in documentation
run: |
# Check for broken internal links in README
python -c "
import re
from pathlib import Path
readme_content = Path('README.md').read_text()
# Find internal file links
internal_links = re.findall(r'\[.*?\]\(([^http][^)]+)\)', readme_content)
broken_links = []
for link in internal_links:
# Remove anchors
file_path = link.split('#')[0]
if file_path and not Path(file_path).exists():
broken_links.append(link)
if broken_links:
print(f'❌ Broken internal links found: {broken_links}')
exit(1)
else:
print('✅ All internal links are valid')
"
- name: Check code examples in README
run: |
python -c "
import re
from pathlib import Path
readme_content = Path('README.md').read_text()
# Find Python code blocks
python_blocks = re.findall(r'```python\n(.*?)\n```', readme_content, re.DOTALL)
bash_blocks = re.findall(r'```bash\n(.*?)\n```', readme_content, re.DOTALL)
print(f'Found {len(python_blocks)} Python code examples')
print(f'Found {len(bash_blocks)} Bash code examples')
# Basic validation - check for common issues
issues = []
for i, block in enumerate(python_blocks):
if 'import' in block and 'moondream_mcp' in block:
if 'from moondream_mcp' not in block and 'import moondream_mcp' not in block:
issues.append(f'Python block {i+1}: Possible import issue')
if issues:
print(f'⚠️ Potential issues in code examples: {issues}')
else:
print('✅ Code examples look good')
"
check-pyproject:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Validate pyproject.toml
run: |
python -c "
import tomllib
from pathlib import Path
try:
with open('pyproject.toml', 'rb') as f:
config = tomllib.load(f)
# Check required fields
project = config.get('project', {})
required_fields = ['name', 'version', 'description', 'authors', 'license']
missing = [field for field in required_fields if field not in project]
if missing:
print(f'❌ Missing required fields in pyproject.toml: {missing}')
exit(1)
print('✅ pyproject.toml is valid and complete')
except Exception as e:
print(f'❌ Error parsing pyproject.toml: {e}')
exit(1)
"
validate-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Check examples directory
run: |
python -c "
import sys
from pathlib import Path
examples_dir = Path('examples')
if not examples_dir.exists():
print('⚠️ No examples directory found')
sys.exit(0)
# Check for required example files
required_examples = [
'README.md',
'requirements.txt',
'QUICKSTART.md'
]
missing = []
for file in required_examples:
if not (examples_dir / file).exists():
missing.append(file)
if missing:
print(f'❌ Missing example files: {missing}')
sys.exit(1)
else:
print('✅ All required example files present')
"
- name: Validate example requirements
run: |
if [ -f examples/requirements.txt ]; then
python -c "
from pathlib import Path
requirements = Path('examples/requirements.txt').read_text()
lines = [line.strip() for line in requirements.split('\n') if line.strip() and not line.startswith('#')]
print(f'Found {len(lines)} requirements in examples/requirements.txt')
# Check for common issues
issues = []
for line in lines:
if '==' not in line and '>=' not in line and '~=' not in line:
issues.append(f'No version specified for: {line}')
if issues:
print(f'⚠️ Potential issues: {issues}')
else:
print('✅ Requirements file looks good')
"
else
echo "⚠️ No examples/requirements.txt found"
fi