Skip to content

Commit aab9c00

Browse files
committed
try ubuntu + firefox without CI env vars
Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent d68fe89 commit aab9c00

File tree

6 files changed

+20
-43
lines changed

6 files changed

+20
-43
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
features: plotly_ndarray,plotly_image,static_export_default,ci
8080
- os: ubuntu-latest
8181
browser: firefox
82-
features: plotly_ndarray,plotly_image,static_export_geckodriver,static_export_downloader,ci
82+
features: plotly_ndarray,plotly_image,static_export_geckodriver,static_export_wd_download,ci
8383
- os: windows-latest
8484
browser: chrome
8585
features: plotly_ndarray,plotly_image,static_export_chromedriver,ci
@@ -132,7 +132,7 @@ jobs:
132132
# Run tests on Ubuntu with Chrome
133133
- name: Run tests (${{ matrix.os }} - Chrome)
134134
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'chrome'
135-
run: cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
135+
run: cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
136136

137137
# Install xvfb for Firefox WebGL support
138138
- name: Install xvfb
@@ -144,12 +144,6 @@ jobs:
144144
# Run tests on Ubuntu with Firefox
145145
- name: Run tests (${{ matrix.os }} - Firefox)
146146
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'firefox'
147-
env:
148-
MOZ_HEADLESS: 1
149-
LIBGL_ALWAYS_SOFTWARE: 1
150-
MESA_GL_VERSION_OVERRIDE: 3.3
151-
MOZ_DISABLE_RDD_SANDBOX: 1
152-
MOZ_DISABLE_CONTENT_SANDBOX: 1
153147
run: |
154148
# Set environment variables for Firefox WebDriver
155149
export BROWSER_PATH="${{ steps.setup-firefox.outputs.firefox-path }}"
@@ -160,12 +154,12 @@ jobs:
160154
echo "BROWSER_PATH: $BROWSER_PATH"
161155
echo "RUST_LOG: $RUST_LOG"
162156
163-
xvfb-run -s "-screen 0 1920x1080x24" cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
157+
xvfb-run -s "-screen 0 1920x1080x24" cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
164158
165159
# Run tests on macOS with Chrome
166160
- name: Run tests (${{ matrix.os }} - Chrome)
167161
if: matrix.os == 'macos-latest' && matrix.browser == 'chrome'
168-
run: cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
162+
run: cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
169163

170164
# Run tests on Windows with Chrome WebDriver
171165
- name: Run tests (${{ matrix.os }} - Chrome)
@@ -183,13 +177,13 @@ jobs:
183177
Write-Host "WEBDRIVER_PATH: $env:WEBDRIVER_PATH"
184178
Write-Host "BROWSER_PATH: $env:BROWSER_PATH"
185179
186-
cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
180+
cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
187181
188182
- name: Upload example.pdf artifact
189183
uses: actions/upload-artifact@v4
190184
with:
191-
name: example-pdf-${{ matrix.os }}
192-
path: ${{ github.workspace }}/plotly_static/example.pdf
185+
name: example-pdf-${{ matrix.os }}-${{ matrix.browser }}
186+
path: ${{ github.workspace }}/plotly_static/example.*
193187
retention-days: 30
194188

195189
code-coverage:

docs/book/src/fundamentals/static_image_export.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The static export functionality is controlled by feature flags in the main `plot
1515
- `static_export_geckodriver`: Uses Firefox for rendering (requires geckodriver)
1616

1717
### Optional Features:
18-
- `static_export_downloader`: Automatically downloads WebDriver binaries at build time
18+
- `static_export_wd_download`: Automatically downloads WebDriver binaries at build time
1919
- `static_export_default`: Convenience feature that includes chromedriver + downloader
2020

2121
### Cargo.toml Configuration Examples:
@@ -27,7 +27,7 @@ plotly = { version = "0.13", features = ["static_export_chromedriver"] }
2727

2828
# With automatic WebDriver download
2929
[dependencies]
30-
plotly = { version = "0.13", features = ["static_export_chromedriver", "static_export_downloader"] }
30+
plotly = { version = "0.13", features = ["static_export_chromedriver", "static_export_wd_download"] }
3131

3232
# Recommended: Default configuration with Firefox + auto-download
3333
[dependencies]
@@ -39,7 +39,7 @@ plotly = { version = "0.13", features = ["static_export_default"] }
3939
1. **WebDriver Installation**: You need either chromedriver or geckodriver installed
4040
- Chrome: Download from https://chromedriver.chromium.org/
4141
- Firefox: Download from https://github.com/mozilla/geckodriver/releases
42-
- Or use the `static_export_downloader` feature for automatic download
42+
- Or use the `static_export_wd_download` feature for automatic download
4343

4444
2. **Browser Installation**: You need Chrome/Chromium or Firefox installed
4545

examples/static_export/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The example uses `static_export_default` which includes:
3131

3232
```toml
3333
# Use Chrome/Chromium instead of Firefox
34-
plotly = { version = "0.13", features = ["static_export_chromedriver", "static_export_downloader"] }
34+
plotly = { version = "0.13", features = ["static_export_chromedriver", "static_export_wd_download"] }
3535

3636
# Manual WebDriver installation (no automatic download)
3737
plotly = { version = "0.13", features = ["static_export_geckodriver"] }

plotly/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ kaleido = ["plotly_kaleido"]
1919
# DEPRECATED: kaleido_download feature will be removed in version 0.14.0. Use plotly_static_download instead.
2020
kaleido_download = ["plotly_kaleido/download"]
2121

22-
static_export_downloader = ["plotly_static/webdriver_download"]
2322
static_export_chromedriver = ["plotly_static", "plotly_static/chromedriver"]
2423
static_export_geckodriver = ["plotly_static", "plotly_static/geckodriver"]
24+
static_export_wd_download = ["plotly_static/webdriver_download"]
2525
static_export_default = ["plotly_static", "plotly_static/chromedriver", "plotly_static/webdriver_download"]
2626

2727
# All non-conflicting features

plotly_static/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,19 +1025,23 @@ impl StaticExporter {
10251025
// Don't close the client - keep it for reuse
10261026
// client.close().await?;
10271027

1028-
let src = data.as_str().ok_or(anyhow!(
1028+
let result = data.as_str().ok_or(anyhow!(
10291029
"Failed to execute Plotly.toImage in browser session"
10301030
))?;
10311031

1032+
if let Some(err) = result.strip_prefix("ERROR:") {
1033+
return Err(anyhow!("JavaScript error during export: {err}"));
1034+
}
1035+
10321036
match plot.format {
1033-
ImageFormat::SVG => Self::extract_plain(src, &plot.format),
1037+
ImageFormat::SVG => Self::extract_plain(result, &plot.format),
10341038
ImageFormat::PNG | ImageFormat::JPEG | ImageFormat::WEBP | ImageFormat::PDF => {
1035-
Self::extract_encoded(src, &plot.format)
1039+
Self::extract_encoded(result, &plot.format)
10361040
}
10371041
#[allow(deprecated)]
10381042
ImageFormat::EPS => {
10391043
error!("EPS format is deprecated. Use SVG or PDF instead.");
1040-
Self::extract_encoded(src, &plot.format)
1044+
Self::extract_encoded(result, &plot.format)
10411045
}
10421046
}
10431047
}

plotly_static/wip.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)