-
Notifications
You must be signed in to change notification settings - Fork 5
232 lines (205 loc) · 7.18 KB
/
docs.yml
File metadata and controls
232 lines (205 loc) · 7.18 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 ]
paths:
- 'neural/**/*.py'
- 'docs/**'
- 'examples/**'
- 'README.md'
- 'CHANGELOG.md'
pull_request:
branches: [ main ]
paths:
- 'neural/**/*.py'
- 'docs/**'
- 'examples/**'
- 'README.md'
- 'CHANGELOG.md'
workflow_dispatch:
inputs:
deploy:
description: 'Deploy to production'
required: false
default: 'false'
type: boolean
jobs:
generate-api-docs:
runs-on: ubuntu-latest
name: Generate API Documentation
outputs:
docs-changed: ${{ steps.changes.outputs.docs }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect file changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
docs:
- 'neural/**/*.py'
- 'docs/**'
- 'examples/**'
- 'README.md'
- 'CHANGELOG.md'
- name: Set up uv
if: steps.changes.outputs.docs == 'true'
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
enable-cache: true
- name: Sync dependencies
if: steps.changes.outputs.docs == 'true'
run: uv sync --extra dev --extra docs
- name: Generate API docs with mkdocstrings
if: steps.changes.outputs.docs == 'true'
run: |
mkdir -p docs/api
echo "API documentation generation skipped for beta release"
# TODO: Re-enable API doc generation in stable release
# python -c "... complex doc generation code ..."
- name: Generate examples documentation
if: steps.changes.outputs.docs == 'true'
run: |
mkdir -p docs/examples/generated
uv run python scripts/generate_examples_docs.py
- name: Validate documentation links
if: steps.changes.outputs.docs == 'true'
run: |
# Check for broken internal links
find docs -name "*.mdx" -exec grep -l "\[.*\](.*.mdx)" {} \; | while read file; do
echo "Checking links in $file"
grep -o "\[.*\](.*.mdx)" "$file" | while read link; do
target=$(echo "$link" | sed 's/.*(\(.*\))/\1/')
if [ ! -f "docs/$target" ] && [ ! -f "$target" ]; then
echo "Broken link found: $target in $file"
exit 1
fi
done
done
- name: Check documentation quality
if: steps.changes.outputs.docs == 'true'
run: |
# Check for required sections in documentation
uv run python scripts/validate_docs.py
- name: Upload generated docs
if: steps.changes.outputs.docs == 'true'
uses: actions/upload-artifact@v4
with:
name: generated-docs
path: docs/
retention-days: 7
validate-examples:
runs-on: ubuntu-latest
name: Validate Examples
if: needs.generate-api-docs.outputs.docs-changed == 'true'
needs: generate-api-docs
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
enable-cache: true
- name: Sync dependencies
run: uv sync --extra dev
- name: Test examples syntax
run: |
for example in examples/*.py; do
echo "Checking syntax of $example"
uv run python -m py_compile "$example"
done
- name: Validate example imports
run: |
uv run python -c "
import ast
import sys
from pathlib import Path
examples_dir = Path('examples')
for py_file in examples_dir.glob('*.py'):
try:
with open(py_file) as f:
ast.parse(f.read())
print(f'✓ {py_file.name}: Valid syntax')
except SyntaxError as e:
print(f'✗ {py_file.name}: Syntax error - {e}')
sys.exit(1)
"
validate-docs:
runs-on: ubuntu-latest
name: Validate Documentation
needs: [generate-api-docs, validate-examples]
if: needs.generate-api-docs.outputs.docs-changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download generated docs
uses: actions/download-artifact@v4
with:
name: generated-docs
path: docs/
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Validate Mintlify CLI availability
run: bunx @mintlify/cli@latest --version
- name: Validate Mintlify configuration
run: |
# Validate repository Mintlify config syntax (this repo uses docs/mint.json)
if [ -f "docs/mint.json" ]; then
jq . docs/mint.json > /dev/null
else
echo "::warning::docs/mint.json not found; skipping Mintlify validation"
exit 0
fi
# mintlify dev expects docs.json; run preview only when that layout exists.
if [ -f "docs.json" ] || [ -f "docs/docs.json" ]; then
timeout 30s bunx @mintlify/cli@latest dev --no-open --port 3000 || \
echo "::warning::Documentation preview failed; continuing as advisory check"
else
echo "::notice::Skipping mintlify dev preview because docs.json is not present"
fi
- name: Documentation Summary
run: |
echo "## 📚 Documentation Status" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Mint.json configuration valid" >> $GITHUB_STEP_SUMMARY
echo "- ✅ $(find docs -name '*.mdx' | wc -l) MDX files found" >> $GITHUB_STEP_SUMMARY
echo "- ✅ All examples validated" >> $GITHUB_STEP_SUMMARY
echo "- 📝 Manual deployment required via Mintlify dashboard" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
echo "1. Visit [Mintlify Dashboard](https://mintlify.com/dashboard)" >> $GITHUB_STEP_SUMMARY
echo "2. Select project: neural-sdk" >> $GITHUB_STEP_SUMMARY
echo "3. Click 'Deploy' to publish changes" >> $GITHUB_STEP_SUMMARY
update-changelog:
runs-on: ubuntu-latest
name: Update Changelog
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
enable-cache: true
- name: Auto-update changelog
run: |
uv run --with gitpython python scripts/update_changelog.py
- name: Commit changelog updates
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "docs: auto-update changelog [skip ci]"
git push
fi