-
Notifications
You must be signed in to change notification settings - Fork 11
166 lines (135 loc) · 4.78 KB
/
Copy pathdocs.yml
File metadata and controls
166 lines (135 loc) · 4.78 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
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 'athena_mcp' in block:
if 'from athena_mcp' not in block and 'import athena_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)
"