1+ name : Documentation Build and Deploy
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+ workflow_dispatch :
9+
10+ permissions :
11+ contents : read
12+ pages : write
13+ id-token : write
14+
15+ # Allow only one concurrent deployment
16+ concurrency :
17+ group : " pages"
18+ cancel-in-progress : false
19+
20+ jobs :
21+ build-docs :
22+ runs-on : windows-latest
23+
24+ steps :
25+ - name : Checkout repository
26+ uses : actions/checkout@v4
27+ with :
28+ fetch-depth : 0
29+
30+ - name : Setup Python
31+ uses : actions/setup-python@v4
32+ with :
33+ python-version : ' 3.9'
34+
35+ - name : Install Python dependencies
36+ run : |
37+ python -m pip install --upgrade pip
38+ pip install -r requirements.txt
39+ pip install matplotlib seaborn pandas
40+
41+ - name : Install Doxygen
42+ run : |
43+ choco install doxygen.install --no-progress
44+ choco install graphviz --no-progress
45+
46+ - name : Verify Doxygen installation
47+ run : |
48+ doxygen --version
49+ dot -V
50+
51+ - name : Setup XMake
52+ uses : xmake-io/github-action-setup-xmake@v1
53+ with :
54+ xmake-version : latest
55+
56+ - name : Configure XMake
57+ run : |
58+ xmake config --with-benchmarks=true --with-testing=true
59+
60+ - name : Build C++ library
61+ run : |
62+ xmake build
63+
64+ - name : Run C++ tests
65+ run : |
66+ xmake test
67+ if (-not $?) { exit 1 }
68+
69+ - name : Run Python tests
70+ run : |
71+ python -m pytest tests/ -v --tb=short
72+ if (-not $?) { exit 1 }
73+
74+ - name : Build benchmarks
75+ run : |
76+ xmake build bench_geometry bench_quadtree
77+
78+ - name : Run benchmarks
79+ run : |
80+ xmake run bench_geometry --benchmark_out=docs/benchmarks/geometry_results.json --benchmark_out_format=json
81+ xmake run bench_quadtree --benchmark_out=docs/benchmarks/spatial_results.json --benchmark_out_format=json
82+ continue-on-error : true
83+
84+ - name : Create performance visualization
85+ run : |
86+ if (Test-Path "docs/benchmarks/geometry_results.json") {
87+ Write-Host "Benchmark results found - creating visualization placeholder"
88+ mkdir -p docs/images
89+ # Create a simple text file as placeholder
90+ "Benchmark results generated on $(Get-Date)" | Out-File -FilePath "docs/images/benchmark_results.txt"
91+ } else {
92+ Write-Host "No benchmark results found"
93+ }
94+ continue-on-error : true
95+
96+ - name : Copy examples to documentation
97+ run : |
98+ if (Test-Path "examples") {
99+ Copy-Item -Path "examples/*.py" -Destination "docs/examples/" -Force
100+ Write-Host "Copied Python examples to documentation"
101+ }
102+
103+ - name : Build documentation with Doxygen
104+ run : |
105+ mkdir -p docs/generated
106+ doxygen Doxyfile
107+ if (Test-Path "docs/generated/html/index.html") {
108+ Write-Host "Documentation built successfully"
109+ } else {
110+ Write-Host "Documentation build failed"
111+ exit 1
112+ }
113+
114+ - name : Setup Pages
115+ uses : actions/configure-pages@v4
116+ if : github.ref == 'refs/heads/main'
117+
118+ - name : Upload artifact
119+ uses : actions/upload-pages-artifact@v3
120+ if : github.ref == 'refs/heads/main'
121+ with :
122+ path : docs/generated/html
123+
124+ - name : Deploy to GitHub Pages
125+ id : deployment
126+ uses : actions/deploy-pages@v4
127+ if : github.ref == 'refs/heads/main'
128+
129+ # Separate job for documentation validation
130+ validate-docs :
131+ runs-on : ubuntu-latest
132+ needs : build-docs
133+ if : github.event_name == 'pull_request'
134+
135+ steps :
136+ - name : Checkout repository
137+ uses : actions/checkout@v4
138+
139+ - name : Setup Python
140+ uses : actions/setup-python@v4
141+ with :
142+ python-version : ' 3.9'
143+
144+ - name : Validate documentation structure
145+ run : |
146+ echo "Validating documentation structure..."
147+ find docs/ -name "*.md" -type f | head -10
148+ echo "Documentation validation completed"
149+
150+ # Build status notification
151+ notify-status :
152+ runs-on : ubuntu-latest
153+ needs : [build-docs]
154+ if : always()
155+
156+ steps :
157+ - name : Documentation Build Status
158+ run : |
159+ if [[ "${{ needs.build-docs.result }}" == "success" ]]; then
160+ echo "✅ Documentation build completed successfully"
161+ echo "📖 Documentation will be available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
162+ else
163+ echo "❌ Documentation build failed"
164+ exit 1
165+ fi
0 commit comments