Fix MSVC 2012 compatibility issues in zlayout.cpp #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Documentation Build and Deploy | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build-docs: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install matplotlib seaborn pandas | |
| - name: Install Doxygen and Graphviz | |
| run: | | |
| Write-Host "Installing Doxygen and Graphviz..." | |
| # Try chocolatey installation first | |
| try { | |
| Write-Host "Attempting chocolatey installation..." | |
| choco install doxygen.install -y --no-progress | |
| choco install graphviz -y --no-progress | |
| # Refresh environment variables | |
| $env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." | |
| Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
| refreshenv | |
| Write-Host "Chocolatey installation completed" | |
| } catch { | |
| Write-Host "Chocolatey installation failed, trying direct download..." | |
| # Fallback: Download Doxygen directly | |
| $doxygenUrl = "https://www.doxygen.nl/files/doxygen-1.9.8.windows.x64.bin.zip" | |
| $doxygenZip = "doxygen.zip" | |
| $doxygenDir = "C:\doxygen" | |
| Write-Host "Downloading Doxygen from $doxygenUrl" | |
| Invoke-WebRequest -Uri $doxygenUrl -OutFile $doxygenZip | |
| Write-Host "Extracting Doxygen..." | |
| Expand-Archive -Path $doxygenZip -DestinationPath $doxygenDir -Force | |
| # Find the actual doxygen executable | |
| $doxygenExe = Get-ChildItem -Path $doxygenDir -Name "doxygen.exe" -Recurse | Select-Object -First 1 | |
| if ($doxygenExe) { | |
| $doxygenPath = Join-Path $doxygenDir $doxygenExe | |
| Write-Host "Found doxygen at: $doxygenPath" | |
| } | |
| } | |
| # Add to PATH explicitly | |
| $env:PATH += ";C:\Program Files\doxygen\bin" | |
| $env:PATH += ";C:\Program Files\Graphviz\bin" | |
| $env:PATH += ";C:\doxygen" | |
| Write-Host "Updated PATH: $env:PATH" | |
| - name: Verify Documentation Tools | |
| run: | | |
| # Final verification with updated PATH | |
| $env:PATH += ";C:\Program Files\doxygen\bin" | |
| $env:PATH += ";C:\Program Files\Graphviz\bin" | |
| $env:PATH += ";C:\doxygen" | |
| Write-Host "=== Final Tool Verification ===" | |
| # Try multiple locations for Doxygen | |
| $doxygenFound = $false | |
| $doxygenPaths = @( | |
| "C:\Program Files\doxygen\bin\doxygen.exe", | |
| "C:\doxygen\doxygen.exe", | |
| "doxygen" | |
| ) | |
| foreach ($path in $doxygenPaths) { | |
| try { | |
| Write-Host "Trying Doxygen at: $path" | |
| if ($path -eq "doxygen") { | |
| $version = doxygen --version 2>&1 | |
| } else { | |
| $version = & $path --version 2>&1 | |
| } | |
| Write-Host "✅ Doxygen found: $version" | |
| $doxygenFound = $true | |
| break | |
| } catch { | |
| Write-Host "❌ Not found at $path" | |
| } | |
| } | |
| if (-not $doxygenFound) { | |
| Write-Host "❌ Doxygen not found in any location!" | |
| exit 1 | |
| } | |
| # Try Graphviz (optional, continue if not found) | |
| try { | |
| $graphvizVersion = & "C:\Program Files\Graphviz\bin\dot.exe" -V 2>&1 | |
| Write-Host "✅ Graphviz found: $graphvizVersion" | |
| } catch { | |
| try { | |
| $graphvizVersion = dot -V 2>&1 | |
| Write-Host "✅ Graphviz found in PATH: $graphvizVersion" | |
| } catch { | |
| Write-Host "⚠️ Graphviz not found - diagrams will be disabled" | |
| } | |
| } | |
| Write-Host "Tools verification completed" | |
| - name: Setup XMake | |
| uses: xmake-io/github-action-setup-xmake@v1 | |
| with: | |
| xmake-version: latest | |
| - name: Configure XMake | |
| run: | | |
| xmake config --with-benchmarks=true --with-testing=true | |
| - name: Build C++ library | |
| run: | | |
| xmake build | |
| - name: Run C++ tests | |
| run: | | |
| xmake test | |
| if (-not $?) { exit 1 } | |
| - name: Run Python tests | |
| run: | | |
| python -m pytest tests/ -v --tb=short | |
| if (-not $?) { exit 1 } | |
| - name: Build benchmarks | |
| run: | | |
| xmake build bench_geometry bench_quadtree | |
| - name: Run benchmarks | |
| run: | | |
| xmake run bench_geometry --benchmark_out=docs/benchmarks/geometry_results.json --benchmark_out_format=json | |
| xmake run bench_quadtree --benchmark_out=docs/benchmarks/spatial_results.json --benchmark_out_format=json | |
| continue-on-error: true | |
| - name: Create performance visualization | |
| run: | | |
| if (Test-Path "docs/benchmarks/geometry_results.json") { | |
| Write-Host "Benchmark results found - creating visualization placeholder" | |
| mkdir -p docs/images | |
| # Create a simple text file as placeholder | |
| "Benchmark results generated on $(Get-Date)" | Out-File -FilePath "docs/images/benchmark_results.txt" | |
| } else { | |
| Write-Host "No benchmark results found" | |
| } | |
| continue-on-error: true | |
| - name: Copy examples to documentation | |
| run: | | |
| if (Test-Path "examples") { | |
| Copy-Item -Path "examples/*.py" -Destination "docs/examples/" -Force | |
| Write-Host "Copied Python examples to documentation" | |
| } | |
| - name: Build documentation with Doxygen | |
| run: | | |
| # Create output directory | |
| if (-not (Test-Path "docs/generated")) { | |
| New-Item -ItemType Directory -Path "docs/generated" -Force | |
| } | |
| # Update PATH for this step | |
| $env:PATH += ";C:\Program Files\doxygen\bin" | |
| $env:PATH += ";C:\Program Files\Graphviz\bin" | |
| $env:PATH += ";C:\doxygen" | |
| Write-Host "Building documentation with Doxygen..." | |
| # Find Doxygen and build documentation | |
| $doxygenBuilt = $false | |
| $doxygenPaths = @( | |
| "C:\Program Files\doxygen\bin\doxygen.exe", | |
| "C:\doxygen\doxygen.exe" | |
| ) | |
| foreach ($path in $doxygenPaths) { | |
| if (Test-Path $path) { | |
| try { | |
| Write-Host "Using Doxygen at: $path" | |
| & $path Doxyfile | |
| $doxygenBuilt = $true | |
| break | |
| } catch { | |
| Write-Host "Failed to run Doxygen at $path" | |
| } | |
| } | |
| } | |
| # Try PATH if explicit paths failed | |
| if (-not $doxygenBuilt) { | |
| try { | |
| Write-Host "Trying doxygen from PATH..." | |
| doxygen Doxyfile | |
| $doxygenBuilt = $true | |
| } catch { | |
| Write-Host "Failed to run doxygen from PATH" | |
| } | |
| } | |
| if (-not $doxygenBuilt) { | |
| Write-Host "❌ Failed to run Doxygen from any location" | |
| exit 1 | |
| } | |
| # Verify documentation was generated | |
| if (Test-Path "docs/generated/html/index.html") { | |
| Write-Host "✅ Documentation built successfully" | |
| Write-Host "Generated files:" | |
| Get-ChildItem "docs/generated/html" | Select-Object Name | Format-Table -AutoSize | |
| } else { | |
| Write-Host "❌ Documentation build failed - index.html not found" | |
| Write-Host "Contents of docs/generated:" | |
| if (Test-Path "docs/generated") { | |
| Get-ChildItem "docs/generated" -Recurse | Select-Object FullName | |
| } | |
| exit 1 | |
| } | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| if: github.ref == 'refs/heads/main' | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| if: github.ref == 'refs/heads/main' | |
| with: | |
| path: docs/generated/html | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| if: github.ref == 'refs/heads/main' | |
| # Separate job for documentation validation | |
| validate-docs: | |
| runs-on: ubuntu-latest | |
| needs: build-docs | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Validate documentation structure | |
| run: | | |
| echo "Validating documentation structure..." | |
| find docs/ -name "*.md" -type f | head -10 | |
| echo "Documentation validation completed" | |
| # Build status notification | |
| notify-status: | |
| runs-on: ubuntu-latest | |
| needs: [build-docs] | |
| if: always() | |
| steps: | |
| - name: Documentation Build Status | |
| run: | | |
| if [[ "${{ needs.build-docs.result }}" == "success" ]]; then | |
| echo "✅ Documentation build completed successfully" | |
| echo "📖 Documentation will be available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" | |
| else | |
| echo "❌ Documentation build failed" | |
| exit 1 | |
| fi |