Repository navigation
196 lines (167 loc) · 5.59 KB
/
Copy pathdocs.yml
File metadata and controls
196 lines (167 loc) · 5.59 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
name: Documentation
on:
push:
branches: [ main ]
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'requirements.txt'
- 'pkg/**'
- '.github/workflows/docs.yml'
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'requirements.txt'
- 'pkg/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION: '1.25'
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Cache Python dependencies
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache Go modules
uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-v2-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-v2-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then
pip install -r requirements.txt
else
pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin
fi
- name: Install Go dependencies
run: |
go mod download
go mod tidy
- name: Generate Go documentation
run: |
mkdir -p docs/api
echo "# Go Package Documentation" > docs/api/generated.md
echo "" >> docs/api/generated.md
echo "Auto-generated API documentation for all packages." >> docs/api/generated.md
echo "" >> docs/api/generated.md
for pkg in $(go list ./pkg/...); do
echo "## Package: $pkg" >> docs/api/generated.md
echo "" >> docs/api/generated.md
echo '```go' >> docs/api/generated.md
go doc -all $pkg >> docs/api/generated.md 2>/dev/null || echo "No documentation available"
echo '```' >> docs/api/generated.md
echo "" >> docs/api/generated.md
done
- name: Build documentation
run: |
if [ -f mkdocs.yml ]; then
mkdocs build --verbose
else
echo "No mkdocs.yml found, creating minimal documentation structure"
mkdir -p site
echo "<html><head><title>GoLangGraph Docs</title></head><body><h1>GoLangGraph Documentation</h1><p>Documentation site is under construction.</p></body></html>" > site/index.html
fi
- name: Test documentation links
run: |
# Install link checker
pip install pytest-html-reporter
# Basic validation - check if HTML files were generated
if [ ! -d "site" ]; then
echo "Error: Documentation site not built"
exit 1
fi
# Count HTML files
HTML_COUNT=$(find site -name "*.html" | wc -l)
echo "Generated $HTML_COUNT HTML files"
if [ $HTML_COUNT -eq 0 ]; then
echo "Error: No HTML files generated"
exit 1
fi
# Check for common issues
find site -name "*.html" -exec grep -l "404\|Not Found\|Error" {} \; | head -5 | while read file; do
echo "Warning: Potential issue in $file"
done
- name: Upload documentation artifacts
uses: actions/upload-artifact@v6
with:
name: documentation
path: site/
retention-days: 7
- name: Upload documentation coverage
uses: actions/upload-artifact@v6
with:
name: documentation-coverage
path: docs/api/generated.md
retention-days: 7
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build
# Pages is optional for this repository. Keep documentation builds required,
# but only deploy after an administrator explicitly enables it as a variable.
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && vars.DEPLOY_GITHUB_PAGES == 'true'
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download documentation artifacts
uses: actions/download-artifact@v6
with:
name: documentation
path: site/
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: site/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Summary
run: |
echo "## Documentation Deployed 🚀" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📚 **Documentation URL:** ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY
echo "🔗 **Direct Link:** [View Documentation](${{ steps.deployment.outputs.page_url }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### What's Included:" >> $GITHUB_STEP_SUMMARY
echo "- Getting Started Guide" >> $GITHUB_STEP_SUMMARY
echo "- API Reference" >> $GITHUB_STEP_SUMMARY
echo "- Examples and Tutorials" >> $GITHUB_STEP_SUMMARY
echo "- Architecture Documentation" >> $GITHUB_STEP_SUMMARY