7070 strategy :
7171 fail-fast : false
7272 matrix :
73- os : [ubuntu-latest, windows-latest, macos-latest]
73+ # os: [ubuntu-latest, windows-latest, macos-latest]
74+ os : [ubuntu-latest, macos-latest]
7475 runs-on : ${{ matrix.os }}
7576 steps :
7677 - name : Setup Chrome
@@ -145,6 +146,366 @@ jobs:
145146 targets : wasm32-unknown-unknown
146147 - run : cd ${{ github.workspace }}/examples/wasm-yew/${{ matrix.example }} && cargo build --target wasm32-unknown-unknown
147148
149+ test_static_export_chrome :
150+ name : Test Static Export with Chrome (Windows)
151+ runs-on : windows-latest
152+ timeout-minutes : 30
153+ steps :
154+ - uses : actions/checkout@v4
155+
156+ - name : Setup Chrome and chromedriver
157+ id : setup-chrome
158+ uses : browser-actions/setup-chrome@v1
159+ with :
160+ chrome-version : ' latest'
161+ install-chromedriver : true
162+
163+ - uses : dtolnay/rust-toolchain@stable
164+
165+ - name : Cache cargo registry
166+ uses : actions/cache@v4
167+ with :
168+ path : |
169+ ~/.cargo/registry/index/
170+ ~/.cargo/registry/cache/
171+ ~/.cargo/git/db/
172+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
173+ restore-keys : |
174+ ${{ runner.os }}-cargo-registry-
175+
176+ - name : Debug - Show setup-chrome outputs
177+ run : |
178+ Write-Host "=== Setup Chrome Action Outputs ==="
179+ Write-Host "chrome-version: ${{ steps.setup-chrome.outputs.chrome-version }}"
180+ Write-Host "chrome-path: ${{ steps.setup-chrome.outputs.chrome-path }}"
181+ Write-Host "chromedriver-version: ${{ steps.setup-chrome.outputs.chromedriver-version }}"
182+ Write-Host "chromedriver-path: ${{ steps.setup-chrome.outputs.chromedriver-path }}"
183+ Write-Host "================================"
184+
185+ - name : Debug - System information
186+ run : |
187+ Write-Host "=== System Information ==="
188+ Write-Host "OS Version: $(Get-ComputerInfo | Select-Object -ExpandProperty WindowsProductName)"
189+ Write-Host "Architecture: $(Get-ComputerInfo | Select-Object -ExpandProperty OsArchitecture)"
190+ Write-Host "Available memory: $((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory / 1MB) MB"
191+ Write-Host "=========================="
192+
193+ - name : Debug - Check Chrome and chromedriver installation
194+ run : |
195+ Write-Host "=== Chrome and Chromedriver Check ==="
196+
197+ # Check if Chrome is in PATH
198+ try {
199+ $chromeVersion = & chrome.exe --version 2>$null
200+ Write-Host "Chrome in PATH: $chromeVersion"
201+ } catch {
202+ Write-Host "Chrome not found in PATH"
203+ }
204+
205+ # Check if chromedriver is in PATH
206+ try {
207+ $chromedriverVersion = & chromedriver.exe --version 2>$null
208+ Write-Host "Chromedriver in PATH: $chromedriverVersion"
209+ } catch {
210+ Write-Host "Chromedriver not found in PATH"
211+ }
212+
213+ # Check specific paths from action outputs
214+ $chromePath = "${{ steps.setup-chrome.outputs.chrome-path }}"
215+ $chromedriverPath = "${{ steps.setup-chrome.outputs.chromedriver-path }}"
216+
217+ Write-Host "Chrome path from action: $chromePath"
218+ Write-Host "Chromedriver path from action: $chromedriverPath"
219+
220+ if (Test-Path $chromePath) {
221+ Write-Host "Chrome file exists: $(Get-Item $chromePath | Select-Object -ExpandProperty FullName)"
222+ Write-Host "Chrome file size: $((Get-Item $chromePath).Length) bytes"
223+ } else {
224+ Write-Host "Chrome file does not exist at specified path"
225+ }
226+
227+ if (Test-Path $chromedriverPath) {
228+ Write-Host "Chromedriver file exists: $(Get-Item $chromedriverPath | Select-Object -ExpandProperty FullName)"
229+ Write-Host "Chromedriver file size: $((Get-Item $chromedriverPath).Length) bytes"
230+
231+ # Test if chromedriver is executable
232+ try {
233+ $testResult = & $chromedriverPath --version 2>&1
234+ Write-Host "Chromedriver executable test: $testResult"
235+ } catch {
236+ Write-Host "Chromedriver executable test failed: $_"
237+ }
238+ } else {
239+ Write-Host "Chromedriver file does not exist at specified path"
240+ }
241+
242+ # Try to find chromedriver in common locations
243+ Write-Host "=== Searching for chromedriver in common locations ==="
244+ $commonPaths = @(
245+ "C:\Program Files\Google\Chrome\Application\chromedriver.exe",
246+ "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe",
247+ "$env:USERPROFILE\AppData\Local\Google\Chrome\Application\chromedriver.exe",
248+ "$env:PROGRAMFILES\Google\Chrome\Application\chromedriver.exe",
249+ "$env:PROGRAMFILES(X86)\Google\Chrome\Application\chromedriver.exe"
250+ )
251+
252+ foreach ($path in $commonPaths) {
253+ if (Test-Path $path) {
254+ Write-Host "Found chromedriver at: $path"
255+ try {
256+ $version = & $path --version 2>&1
257+ Write-Host " Version: $version"
258+ } catch {
259+ Write-Host " Version check failed: $_"
260+ }
261+ }
262+ }
263+
264+ Write-Host "================================"
265+
266+ - name : Debug - Check Rust toolchain and dependencies
267+ run : |
268+ Write-Host "=== Rust Toolchain Check ==="
269+ rustc --version
270+ cargo --version
271+ Write-Host "Current directory: $(Get-Location)"
272+ Write-Host "Workspace contents:"
273+ Get-ChildItem -Name | Sort-Object
274+ Write-Host "=========================="
275+
276+ - name : Debug - Check plotly_static package
277+ run : |
278+ Write-Host "=== Plotly Static Package Check ==="
279+ cd plotly_static
280+ Write-Host "Package contents:"
281+ Get-ChildItem -Name | Sort-Object
282+ Write-Host "Cargo.toml contents:"
283+ Get-Content Cargo.toml
284+ Write-Host "================================"
285+
286+ - name : Debug - Test chromedriver functionality
287+ run : |
288+ Write-Host "=== Testing Chromedriver Functionality ==="
289+
290+ # Test if chromedriver is in PATH and working
291+ try {
292+ $chromedriverVersion = & chromedriver.exe --version 2>&1
293+ Write-Host "Chromedriver in PATH: $chromedriverVersion"
294+
295+ # Try to start chromedriver in background
296+ Write-Host "Testing chromedriver startup..."
297+ $process = Start-Process -FilePath "chromedriver.exe" -ArgumentList "--port=4444" -PassThru -WindowStyle Hidden
298+ Start-Sleep -Seconds 3
299+
300+ # Check if it's running
301+ $isRunning = Get-Process -Name "chromedriver" -ErrorAction SilentlyContinue
302+ if ($isRunning) {
303+ Write-Host "Chromedriver started successfully, PID: $($process.Id)"
304+
305+ # Test WebDriver status endpoint
306+ try {
307+ $response = Invoke-WebRequest -Uri "http://localhost:4444/status" -TimeoutSec 5
308+ Write-Host "WebDriver status response: $($response.StatusCode)"
309+ Write-Host "Response content: $($response.Content)"
310+ } catch {
311+ Write-Host "WebDriver status check failed: $_"
312+ }
313+
314+ # Stop the process
315+ Stop-Process -Id $process.Id -Force
316+ Write-Host "Chromedriver stopped"
317+ } else {
318+ Write-Host "Chromedriver failed to start"
319+ }
320+ } catch {
321+ Write-Host "Chromedriver test failed: $_"
322+ }
323+
324+ Write-Host "================================"
325+
326+ - name : Debug - Test Rust WebDriver spawning
327+ run : |
328+ Write-Host "=== Testing Rust WebDriver Spawning ==="
329+
330+ # Set environment variables - WEBDRIVER_PATH should point to full executable path
331+ $env:WEBDRIVER_PATH = "${{ steps.setup-chrome.outputs.chromedriver-path }}"
332+ $env:CHROME_PATH = "${{ steps.setup-chrome.outputs.chrome-path }}"
333+ $env:RUST_LOG = "debug"
334+ $env:RUST_BACKTRACE = "1"
335+
336+ Write-Host "Environment variables:"
337+ Write-Host "WEBDRIVER_PATH: $env:WEBDRIVER_PATH"
338+ Write-Host "CHROME_PATH: $env:CHROME_PATH"
339+
340+ # Try to compile and run a simple test
341+ Write-Host "Compiling simple WebDriver test..."
342+ cd plotly_static
343+
344+ # Try to run a simple WebDriver test
345+ try {
346+ Write-Host "Testing WebDriver creation with cargo test..."
347+ cargo test --verbose --package plotly_static --features chromedriver tests::save_png -- --nocapture
348+ } catch {
349+ Write-Host "Simple WebDriver test failed: $_"
350+ }
351+
352+ Write-Host "================================"
353+
354+ - name : Debug - Pre-update cargo index
355+ run : |
356+ Write-Host "=== Pre-update Cargo Index Check ==="
357+ Write-Host "Current cargo index status:"
358+ cargo search --limit 1 plotly 2>&1 | Select-String -Pattern "Updating|Downloading|error" || Write-Host "Index seems up to date"
359+ Write-Host "================================"
360+
361+ - name : Update cargo index (if needed)
362+ run : |
363+ Write-Host "=== Updating Cargo Index ==="
364+ # Force update the index with a timeout
365+ $timeout = 300 # 5 minutes
366+ $job = Start-Job -ScriptBlock {
367+ cargo update --dry-run
368+ }
369+
370+ try {
371+ Wait-Job $job -Timeout $timeout
372+ $result = Receive-Job $job
373+ Write-Host "Cargo update result: $result"
374+ if ($job.State -eq "Completed") {
375+ Write-Host "Cargo index updated successfully"
376+ } else {
377+ Write-Host "Cargo index update timed out, continuing anyway"
378+ Stop-Job $job
379+ }
380+ } catch {
381+ Write-Host "Cargo index update failed: $_"
382+ Write-Host "Continuing with test anyway..."
383+ } finally {
384+ if ($job) {
385+ Remove-Job $job -Force -ErrorAction SilentlyContinue
386+ }
387+ }
388+ Write-Host "================================"
389+
390+ - name : Pre-compile dependencies
391+ run : |
392+ Write-Host "=== Pre-compiling Dependencies ==="
393+
394+ # Set environment variables - WEBDRIVER_PATH should point to full executable path
395+ $env:WEBDRIVER_PATH = "${{ steps.setup-chrome.outputs.chromedriver-path }}"
396+ $env:CHROME_PATH = "${{ steps.setup-chrome.outputs.chrome-path }}"
397+ $env:RUST_LOG = "debug"
398+ $env:RUST_BACKTRACE = "1"
399+
400+ Write-Host "Pre-compiling plotly_static with features..."
401+ # Note: We don't need webdriver_download feature since chromedriver is already installed
402+ cargo check --verbose --package plotly_static --features chromedriver
403+
404+ Write-Host "Dependencies pre-compiled successfully"
405+
406+ - name : Run PNG export test with Chrome
407+ run : |
408+ Write-Host "=== Starting PNG Export Test ==="
409+
410+ # Try to find chromedriver if action output path doesn't work
411+ $chromedriverPath = "${{ steps.setup-chrome.outputs.chromedriver-path }}"
412+ if (-not (Test-Path $chromedriverPath)) {
413+ Write-Host "Action output chromedriver path not found, searching for alternatives..."
414+
415+ # Try common locations
416+ $commonPaths = @(
417+ "C:\Program Files\Google\Chrome\Application\chromedriver.exe",
418+ "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe",
419+ "$env:USERPROFILE\AppData\Local\Google\Chrome\Application\chromedriver.exe",
420+ "$env:PROGRAMFILES\Google\Chrome\Application\chromedriver.exe",
421+ "$env:PROGRAMFILES(X86)\Google\Chrome\Application\chromedriver.exe"
422+ )
423+
424+ foreach ($path in $commonPaths) {
425+ if (Test-Path $path) {
426+ Write-Host "Using chromedriver from: $path"
427+ $chromedriverPath = $path
428+ break
429+ }
430+ }
431+ }
432+
433+ # Set environment variables - WEBDRIVER_PATH should point to full executable path
434+ $env:WEBDRIVER_PATH = $chromedriverPath
435+
436+ # Use the Chrome installed by setup-chrome action (not the system Chrome)
437+ $env:CHROME_PATH = "C:\hostedtoolcache\windows\setup-chrome\chromium\1481497\x64\chrome.exe"
438+ Write-Host "Using Chrome from setup-chrome installation: $env:CHROME_PATH"
439+
440+ $env:RUST_LOG = "debug"
441+ $env:RUST_BACKTRACE = "1"
442+
443+ Write-Host "Environment variables set:"
444+ Write-Host "WEBDRIVER_PATH: $env:WEBDRIVER_PATH"
445+ Write-Host "CHROME_PATH: $env:CHROME_PATH"
446+ Write-Host "RUST_LOG: $env:RUST_LOG"
447+ Write-Host "RUST_BACKTRACE: $env:RUST_BACKTRACE"
448+
449+ # Debug: Check what Chrome versions are available
450+ Write-Host "Available Chrome installations:"
451+ if (Test-Path "$env:CHROME_PATH") {
452+ Write-Host "Chrome at CHROME_PATH: $env:CHROME_PATH"
453+ try {
454+ $chromeVersion = & "$env:CHROME_PATH" --version 2>&1
455+ Write-Host "Chrome version: $chromeVersion"
456+ } catch {
457+ Write-Host "Failed to get Chrome version: $_"
458+ }
459+ }
460+
461+ # Check system Chrome
462+ $systemChrome = "C:\Program Files\Google\Chrome\Application\chrome.exe"
463+ if (Test-Path $systemChrome) {
464+ Write-Host "System Chrome found at: $systemChrome"
465+ try {
466+ $systemChromeVersion = & $systemChrome --version 2>&1
467+ Write-Host "System Chrome version: $systemChromeVersion"
468+ } catch {
469+ Write-Host "Failed to get system Chrome version: $_"
470+ }
471+ }
472+
473+ # Check if CHROME_BIN environment variable is being set correctly
474+ Write-Host "CHROME_BIN environment variable will be set to: $env:CHROME_PATH"
475+
476+ # Test the Chrome version that will be used
477+ if (Test-Path $env:CHROME_PATH) {
478+ try {
479+ $chromeVersion = & $env:CHROME_PATH --version 2>&1
480+ Write-Host "Chrome version that will be used: $chromeVersion"
481+ } catch {
482+ Write-Host "Failed to get Chrome version: $_"
483+ }
484+ } else {
485+ Write-Host "WARNING: Chrome path does not exist: $env:CHROME_PATH"
486+ }
487+
488+ # Verify the paths exist
489+ if (-not (Test-Path $env:WEBDRIVER_PATH)) {
490+ Write-Error "Chromedriver executable not found at: $env:WEBDRIVER_PATH"
491+ Write-Host "Available chromedriver locations:"
492+ Get-ChildItem -Path "C:\Program Files\Google\Chrome\Application\" -Name "chromedriver*" -ErrorAction SilentlyContinue
493+ Get-ChildItem -Path "C:\Program Files (x86)\Google\Chrome\Application\" -Name "chromedriver*" -ErrorAction SilentlyContinue
494+ exit 1
495+ }
496+ if (-not (Test-Path $env:CHROME_PATH)) {
497+ Write-Error "Chrome not found at: $env:CHROME_PATH"
498+ exit 1
499+ }
500+
501+ Write-Host "All paths verified, starting cargo test..."
502+
503+ # Run the test directly without PowerShell job complexity
504+ # Note: We don't need webdriver_download feature since chromedriver is already installed
505+ cargo test --verbose --package plotly_static --features chromedriver tests::save_png -- --nocapture
506+
507+ Write-Host "=== PNG Export Test Completed ==="
508+
148509 build_book :
149510 name : Build Book
150511 runs-on : ubuntu-latest
@@ -156,6 +517,7 @@ jobs:
156517 with :
157518 chrome-version : ' latest'
158519 install-chromedriver : true
520+ id : setup-chrome
159521
160522 - uses : dtolnay/rust-toolchain@stable
161523 - run : cargo install mdbook --no-default-features --features search --vers "^0.4" --locked --quiet
0 commit comments