Skip to content

Commit e2a3776

Browse files
committed
add ubuntu firefox job to test matrix
Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent c45f9bb commit e2a3776

File tree

2 files changed

+67
-11
lines changed

2 files changed

+67
-11
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,37 @@ jobs:
7070
strategy:
7171
fail-fast: false
7272
matrix:
73-
os: [ubuntu-latest, windows-latest, macos-latest]
73+
include:
74+
- os: ubuntu-latest
75+
browser: chrome
76+
features: plotly_ndarray,plotly_image,static_export_default
77+
- os: ubuntu-latest
78+
browser: firefox
79+
features: plotly_ndarray,plotly_image,static_export_geckodriver,static_export_downloader
80+
- os: windows-latest
81+
browser: chrome
82+
features: plotly_ndarray,plotly_image,static_export_chromedriver
83+
- os: macos-latest
84+
browser: chrome
85+
features: plotly_ndarray,plotly_image,static_export_default
7486
runs-on: ${{ matrix.os }}
7587
timeout-minutes: ${{ matrix.os == 'windows-latest' && 30 || 10 }}
7688
steps:
7789
- name: Setup Chrome
90+
if: matrix.browser == 'chrome'
7891
uses: browser-actions/setup-chrome@v1
7992
with:
8093
chrome-version: 'latest'
8194
install-chromedriver: true
8295
id: setup-chrome
8396

97+
- name: Setup Firefox
98+
if: matrix.browser == 'firefox'
99+
uses: browser-actions/setup-firefox@v1
100+
with:
101+
firefox-version: 'latest'
102+
id: setup-firefox
103+
84104
- uses: actions/checkout@v4
85105

86106
- uses: dtolnay/rust-toolchain@stable
@@ -106,14 +126,50 @@ jobs:
106126
-ChromePath "${{ steps.setup-chrome.outputs.chrome-path }}" `
107127
-ChromeDriverPath "${{ steps.setup-chrome.outputs.chromedriver-path }}"
108128
109-
# Run tests on non-Windows platforms
110-
- name: Run tests (${{ matrix.os }})
111-
if: matrix.os != 'windows-latest'
112-
run: cargo test --verbose --workspace --features plotly_ndarray,plotly_image,static_export_default --exclude plotly_kaleido
129+
# Run tests on Ubuntu with Chrome
130+
- name: Run tests (${{ matrix.os }} - Chrome)
131+
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'chrome'
132+
run: cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
133+
134+
# Run save_surface_to_png test with nocapture for detailed webdriver logs
135+
- name: Run save_surface_to_png test with nocapture (${{ matrix.os }} - Firefox)
136+
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'firefox'
137+
run: |
138+
# Set environment variables for Firefox WebDriver
139+
export BROWSER_PATH="${{ steps.setup-firefox.outputs.firefox-path }}"
140+
export RUST_LOG="debug"
141+
export RUST_BACKTRACE="1"
142+
143+
echo "Environment variables set:"
144+
echo "BROWSER_PATH: $BROWSER_PATH"
145+
echo "RUST_LOG: $RUST_LOG"
146+
147+
# Run only the save_surface_to_png test with nocapture for full webdriver logs
148+
cargo test save_surface_to_png --verbose --features ${{ matrix.features }} -- --nocapture
149+
150+
# Run tests on Ubuntu with Firefox
151+
- name: Run tests (${{ matrix.os }} - Firefox)
152+
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'firefox'
153+
run: |
154+
# Set environment variables for Firefox WebDriver
155+
export BROWSER_PATH="${{ steps.setup-firefox.outputs.firefox-path }}"
156+
export RUST_LOG="debug"
157+
export RUST_BACKTRACE="1"
158+
159+
echo "Environment variables set:"
160+
echo "BROWSER_PATH: $BROWSER_PATH"
161+
echo "RUST_LOG: $RUST_LOG"
162+
163+
cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
164+
165+
# Run tests on macOS with Chrome
166+
- name: Run tests (${{ matrix.os }} - Chrome)
167+
if: matrix.os == 'macos-latest' && matrix.browser == 'chrome'
168+
run: cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
113169

114170
# Run tests on Windows with Chrome WebDriver
115-
- name: Run tests (${{ matrix.os }})
116-
if: matrix.os == 'windows-latest'
171+
- name: Run tests (${{ matrix.os }} - Chrome)
172+
if: matrix.os == 'windows-latest' && matrix.browser == 'chrome'
117173
shell: pwsh
118174
run: |
119175
# Set environment variables for WebDriver
@@ -127,7 +183,7 @@ jobs:
127183
Write-Host "WEBDRIVER_PATH: $env:WEBDRIVER_PATH"
128184
Write-Host "BROWSER_PATH: $env:BROWSER_PATH"
129185
130-
cargo test --verbose --workspace --features plotly_ndarray,plotly_image,static_export_chromedriver --exclude plotly_kaleido
186+
cargo test --verbose --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
131187
132188
- name: Upload example.pdf artifact
133189
uses: actions/upload-artifact@v4

plotly_static/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
//! export BROWSER_PATH="/path/to/chrome"
109109
//!
110110
//! # For Firefox
111-
//! export FIREFOX_PATH="/path/to/firefox"
111+
//! export BROWSER_PATH="/path/to/firefox"
112112
//! ```
113113
//!
114114
//! The library will automatically use these binaries when creating WebDriver
@@ -1092,9 +1092,9 @@ impl StaticExporter {
10921092
browser_opts.insert("binary".to_string(), serde_json::json!(chrome_path));
10931093
debug!("Added Chrome binary capability: {chrome_path}");
10941094
}
1095-
// Add Firefox binary capability if FIREFOX_PATH is set
1095+
// Add Firefox binary capability if BROWSER_PATH is set
10961096
#[cfg(feature = "geckodriver")]
1097-
if let Ok(firefox_path) = std::env::var("FIREFOX_PATH") {
1097+
if let Ok(firefox_path) = std::env::var("BROWSER_PATH") {
10981098
browser_opts.insert("binary".to_string(), serde_json::json!(firefox_path));
10991099
debug!("Added Firefox binary capability: {}", firefox_path);
11001100
}

0 commit comments

Comments
 (0)