Skip to content

Commit d696b2e

Browse files
committed
Fix Doxygen installation in GitHub Actions workflow
- Add explicit installation steps with fallback methods - Use chocolatey installation with proper PATH updates - Add direct download fallback if chocolatey fails - Implement robust verification steps for multiple installation locations - Ensure documentation build works with different Doxygen installation paths - Add better error handling and debugging output
1 parent c3cfe61 commit d696b2e

File tree

1 file changed

+151
-10
lines changed

1 file changed

+151
-10
lines changed

.github/workflows/docs.yml

Lines changed: 151 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,103 @@ jobs:
3838
pip install -r requirements.txt
3939
pip install matplotlib seaborn pandas
4040
41-
- name: Install Doxygen
41+
- name: Install Doxygen and Graphviz
4242
run: |
43-
choco install doxygen.install --no-progress
44-
choco install graphviz --no-progress
43+
Write-Host "Installing Doxygen and Graphviz..."
44+
45+
# Try chocolatey installation first
46+
try {
47+
Write-Host "Attempting chocolatey installation..."
48+
choco install doxygen.install -y --no-progress
49+
choco install graphviz -y --no-progress
50+
51+
# Refresh environment variables
52+
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
53+
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
54+
refreshenv
55+
56+
Write-Host "Chocolatey installation completed"
57+
} catch {
58+
Write-Host "Chocolatey installation failed, trying direct download..."
59+
60+
# Fallback: Download Doxygen directly
61+
$doxygenUrl = "https://www.doxygen.nl/files/doxygen-1.9.8.windows.x64.bin.zip"
62+
$doxygenZip = "doxygen.zip"
63+
$doxygenDir = "C:\doxygen"
64+
65+
Write-Host "Downloading Doxygen from $doxygenUrl"
66+
Invoke-WebRequest -Uri $doxygenUrl -OutFile $doxygenZip
67+
68+
Write-Host "Extracting Doxygen..."
69+
Expand-Archive -Path $doxygenZip -DestinationPath $doxygenDir -Force
70+
71+
# Find the actual doxygen executable
72+
$doxygenExe = Get-ChildItem -Path $doxygenDir -Name "doxygen.exe" -Recurse | Select-Object -First 1
73+
if ($doxygenExe) {
74+
$doxygenPath = Join-Path $doxygenDir $doxygenExe
75+
Write-Host "Found doxygen at: $doxygenPath"
76+
}
77+
}
78+
79+
# Add to PATH explicitly
80+
$env:PATH += ";C:\Program Files\doxygen\bin"
81+
$env:PATH += ";C:\Program Files\Graphviz\bin"
82+
$env:PATH += ";C:\doxygen"
83+
84+
Write-Host "Updated PATH: $env:PATH"
4585
46-
- name: Verify Doxygen installation
86+
- name: Verify Documentation Tools
4787
run: |
48-
doxygen --version
49-
dot -V
88+
# Final verification with updated PATH
89+
$env:PATH += ";C:\Program Files\doxygen\bin"
90+
$env:PATH += ";C:\Program Files\Graphviz\bin"
91+
$env:PATH += ";C:\doxygen"
92+
93+
Write-Host "=== Final Tool Verification ==="
94+
95+
# Try multiple locations for Doxygen
96+
$doxygenFound = $false
97+
$doxygenPaths = @(
98+
"C:\Program Files\doxygen\bin\doxygen.exe",
99+
"C:\doxygen\doxygen.exe",
100+
"doxygen"
101+
)
102+
103+
foreach ($path in $doxygenPaths) {
104+
try {
105+
Write-Host "Trying Doxygen at: $path"
106+
if ($path -eq "doxygen") {
107+
$version = doxygen --version 2>&1
108+
} else {
109+
$version = & $path --version 2>&1
110+
}
111+
Write-Host "✅ Doxygen found: $version"
112+
$doxygenFound = $true
113+
break
114+
} catch {
115+
Write-Host "❌ Not found at $path"
116+
}
117+
}
118+
119+
if (-not $doxygenFound) {
120+
Write-Host "❌ Doxygen not found in any location!"
121+
exit 1
122+
}
123+
124+
# Try Graphviz (optional, continue if not found)
125+
try {
126+
$graphvizVersion = & "C:\Program Files\Graphviz\bin\dot.exe" -V 2>&1
127+
Write-Host "✅ Graphviz found: $graphvizVersion"
128+
} catch {
129+
try {
130+
$graphvizVersion = dot -V 2>&1
131+
Write-Host "✅ Graphviz found in PATH: $graphvizVersion"
132+
} catch {
133+
Write-Host "⚠️ Graphviz not found - diagrams will be disabled"
134+
}
135+
}
136+
137+
Write-Host "Tools verification completed"
50138
51139
- name: Setup XMake
52140
uses: xmake-io/github-action-setup-xmake@v1
@@ -102,12 +190,65 @@ jobs:
102190
103191
- name: Build documentation with Doxygen
104192
run: |
105-
mkdir -p docs/generated
106-
doxygen Doxyfile
193+
# Create output directory
194+
if (-not (Test-Path "docs/generated")) {
195+
New-Item -ItemType Directory -Path "docs/generated" -Force
196+
}
197+
198+
# Update PATH for this step
199+
$env:PATH += ";C:\Program Files\doxygen\bin"
200+
$env:PATH += ";C:\Program Files\Graphviz\bin"
201+
$env:PATH += ";C:\doxygen"
202+
203+
Write-Host "Building documentation with Doxygen..."
204+
205+
# Find Doxygen and build documentation
206+
$doxygenBuilt = $false
207+
$doxygenPaths = @(
208+
"C:\Program Files\doxygen\bin\doxygen.exe",
209+
"C:\doxygen\doxygen.exe"
210+
)
211+
212+
foreach ($path in $doxygenPaths) {
213+
if (Test-Path $path) {
214+
try {
215+
Write-Host "Using Doxygen at: $path"
216+
& $path Doxyfile
217+
$doxygenBuilt = $true
218+
break
219+
} catch {
220+
Write-Host "Failed to run Doxygen at $path"
221+
}
222+
}
223+
}
224+
225+
# Try PATH if explicit paths failed
226+
if (-not $doxygenBuilt) {
227+
try {
228+
Write-Host "Trying doxygen from PATH..."
229+
doxygen Doxyfile
230+
$doxygenBuilt = $true
231+
} catch {
232+
Write-Host "Failed to run doxygen from PATH"
233+
}
234+
}
235+
236+
if (-not $doxygenBuilt) {
237+
Write-Host "❌ Failed to run Doxygen from any location"
238+
exit 1
239+
}
240+
241+
# Verify documentation was generated
107242
if (Test-Path "docs/generated/html/index.html") {
108-
Write-Host "Documentation built successfully"
243+
Write-Host "✅ Documentation built successfully"
244+
Write-Host "Generated files:"
245+
Get-ChildItem "docs/generated/html" | Select-Object Name | Format-Table -AutoSize
109246
} else {
110-
Write-Host "Documentation build failed"
247+
Write-Host "❌ Documentation build failed - index.html not found"
248+
Write-Host "Contents of docs/generated:"
249+
if (Test-Path "docs/generated") {
250+
Get-ChildItem "docs/generated" -Recurse | Select-Object FullName
251+
}
111252
exit 1
112253
}
113254

0 commit comments

Comments
 (0)