|
70 | 70 | strategy: |
71 | 71 | fail-fast: false |
72 | 72 | matrix: |
73 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
| 73 | + # os: [ubuntu-latest, windows-latest, macos-latest] |
| 74 | + os: [ubuntu-latest, macos-latest] |
74 | 75 | runs-on: ${{ matrix.os }} |
75 | 76 | steps: |
76 | 77 | - name: Setup Chrome |
@@ -145,6 +146,199 @@ jobs: |
145 | 146 | targets: wasm32-unknown-unknown |
146 | 147 | - run: cd ${{ github.workspace }}/examples/wasm-yew/${{ matrix.example }} && cargo build --target wasm32-unknown-unknown |
147 | 148 |
|
| 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 | + } else { |
| 231 | + Write-Host "Chromedriver file does not exist at specified path" |
| 232 | + } |
| 233 | + |
| 234 | + Write-Host "================================" |
| 235 | + |
| 236 | + - name: Debug - Check Rust toolchain and dependencies |
| 237 | + run: | |
| 238 | + Write-Host "=== Rust Toolchain Check ===" |
| 239 | + rustc --version |
| 240 | + cargo --version |
| 241 | + Write-Host "Current directory: $(Get-Location)" |
| 242 | + Write-Host "Workspace contents:" |
| 243 | + Get-ChildItem -Name | Sort-Object |
| 244 | + Write-Host "==========================" |
| 245 | + |
| 246 | + - name: Debug - Check plotly_static package |
| 247 | + run: | |
| 248 | + Write-Host "=== Plotly Static Package Check ===" |
| 249 | + cd plotly_static |
| 250 | + Write-Host "Package contents:" |
| 251 | + Get-ChildItem -Name | Sort-Object |
| 252 | + Write-Host "Cargo.toml contents:" |
| 253 | + Get-Content Cargo.toml |
| 254 | + Write-Host "================================" |
| 255 | + |
| 256 | + - name: Debug - Pre-update cargo index |
| 257 | + run: | |
| 258 | + Write-Host "=== Pre-update Cargo Index Check ===" |
| 259 | + Write-Host "Current cargo index status:" |
| 260 | + cargo search --limit 1 plotly 2>&1 | Select-String -Pattern "Updating|Downloading|error" || Write-Host "Index seems up to date" |
| 261 | + Write-Host "================================" |
| 262 | + |
| 263 | + - name: Update cargo index (if needed) |
| 264 | + run: | |
| 265 | + Write-Host "=== Updating Cargo Index ===" |
| 266 | + # Force update the index with a timeout |
| 267 | + $timeout = 300 # 5 minutes |
| 268 | + $job = Start-Job -ScriptBlock { |
| 269 | + cargo update --dry-run |
| 270 | + } |
| 271 | + |
| 272 | + try { |
| 273 | + Wait-Job $job -Timeout $timeout |
| 274 | + $result = Receive-Job $job |
| 275 | + Write-Host "Cargo update result: $result" |
| 276 | + if ($job.State -eq "Completed") { |
| 277 | + Write-Host "Cargo index updated successfully" |
| 278 | + } else { |
| 279 | + Write-Host "Cargo index update timed out, continuing anyway" |
| 280 | + Stop-Job $job |
| 281 | + } |
| 282 | + } catch { |
| 283 | + Write-Host "Cargo index update failed: $_" |
| 284 | + Write-Host "Continuing with test anyway..." |
| 285 | + } finally { |
| 286 | + if ($job) { |
| 287 | + Remove-Job $job -Force -ErrorAction SilentlyContinue |
| 288 | + } |
| 289 | + } |
| 290 | + Write-Host "================================" |
| 291 | + |
| 292 | + - name: Pre-compile dependencies |
| 293 | + run: | |
| 294 | + Write-Host "=== Pre-compiling Dependencies ===" |
| 295 | + |
| 296 | + # Set environment variables |
| 297 | + $env:WEBDRIVER_PATH = "${{ steps.setup-chrome.outputs.chromedriver-path }}" |
| 298 | + $env:CHROME_PATH = "${{ steps.setup-chrome.outputs.chrome-path }}" |
| 299 | + $env:RUST_LOG = "debug" |
| 300 | + $env:RUST_BACKTRACE = "1" |
| 301 | + |
| 302 | + Write-Host "Pre-compiling plotly_static with features..." |
| 303 | + # Note: We don't need webdriver_download feature since chromedriver is already installed |
| 304 | + cargo check --verbose --package plotly_static --features chromedriver |
| 305 | + |
| 306 | + Write-Host "Dependencies pre-compiled successfully" |
| 307 | + |
| 308 | + - name: Run PNG export test with Chrome |
| 309 | + run: | |
| 310 | + Write-Host "=== Starting PNG Export Test ===" |
| 311 | + |
| 312 | + # Set environment variables |
| 313 | + $env:WEBDRIVER_PATH = "${{ steps.setup-chrome.outputs.chromedriver-path }}" |
| 314 | + $env:CHROME_PATH = "${{ steps.setup-chrome.outputs.chrome-path }}" |
| 315 | + $env:RUST_LOG = "debug" |
| 316 | + $env:RUST_BACKTRACE = "1" |
| 317 | + |
| 318 | + Write-Host "Environment variables set:" |
| 319 | + Write-Host "WEBDRIVER_PATH: $env:WEBDRIVER_PATH" |
| 320 | + Write-Host "CHROME_PATH: $env:CHROME_PATH" |
| 321 | + Write-Host "RUST_LOG: $env:RUST_LOG" |
| 322 | + Write-Host "RUST_BACKTRACE: $env:RUST_BACKTRACE" |
| 323 | + |
| 324 | + # Verify the paths exist |
| 325 | + if (-not (Test-Path $env:WEBDRIVER_PATH)) { |
| 326 | + Write-Error "Chromedriver not found at: $env:WEBDRIVER_PATH" |
| 327 | + exit 1 |
| 328 | + } |
| 329 | + if (-not (Test-Path $env:CHROME_PATH)) { |
| 330 | + Write-Error "Chrome not found at: $env:CHROME_PATH" |
| 331 | + exit 1 |
| 332 | + } |
| 333 | + |
| 334 | + Write-Host "All paths verified, starting cargo test..." |
| 335 | + |
| 336 | + # Run the test directly without PowerShell job complexity |
| 337 | + # Note: We don't need webdriver_download feature since chromedriver is already installed |
| 338 | + cargo test --verbose --package plotly_static --features chromedriver tests::save_png -- --nocapture |
| 339 | + |
| 340 | + Write-Host "=== PNG Export Test Completed ===" |
| 341 | +
|
148 | 342 | build_book: |
149 | 343 | name: Build Book |
150 | 344 | runs-on: ubuntu-latest |
|
0 commit comments