Skip to content

Commit 778ee1f

Browse files
ci: fix driver downloads, use pre-installed
- Export WEBDRIVER_PATH to reuse pre-installed runners drivers. - Remove harmful stub fallback causing OS Error 193. Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
1 parent a4b71f1 commit 778ee1f

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ jobs:
4343
components: clippy
4444
targets: wasm32-unknown-unknown
4545
# lint plotly_static for all features
46-
- run: cargo clippy -p plotly_static --features geckodriver,webdriver_download -- -D warnings -A deprecated
47-
- run: cargo clippy -p plotly_static --features chromedriver,webdriver_download -- -D warnings -A deprecated
46+
- run: |
47+
export WEBDRIVER_PATH="${{ steps.setup-chrome.outputs.chromedriver-path }}"
48+
export BROWSER_PATH="${{ steps.setup-chrome.outputs.chrome-path }}"
49+
cargo clippy -p plotly_static --features geckodriver,webdriver_download -- -D warnings -A deprecated
50+
cargo clippy -p plotly_static --features chromedriver,webdriver_download -- -D warnings -A deprecated
4851
# lint the main library workspace for non-wasm target
4952
- run: cargo clippy --features all -- -D warnings -A deprecated
5053
# lint the non-wasm examples
@@ -132,7 +135,10 @@ jobs:
132135
# Run tests on Ubuntu with Chrome
133136
- name: Run tests (${{ matrix.os }} - Chrome)
134137
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'chrome'
135-
run: cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
138+
run: |
139+
export WEBDRIVER_PATH="${{ steps.setup-chrome.outputs.chromedriver-path }}"
140+
export BROWSER_PATH="${{ steps.setup-chrome.outputs.chrome-path }}"
141+
cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
136142
137143
# Install xvfb for Firefox WebGL support
138144
- name: Install xvfb
@@ -146,6 +152,7 @@ jobs:
146152
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'firefox'
147153
run: |
148154
# Set environment variables for Firefox WebDriver
155+
export WEBDRIVER_PATH="/usr/local/share/gecko_driver"
149156
export BROWSER_PATH="${{ steps.setup-firefox.outputs.firefox-path }}"
150157
export RUST_LOG="debug"
151158
export RUST_BACKTRACE="1"
@@ -159,7 +166,10 @@ jobs:
159166
# Run tests on macOS with Chrome
160167
- name: Run tests (${{ matrix.os }} - Chrome)
161168
if: matrix.os == 'macos-latest' && matrix.browser == 'chrome'
162-
run: cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
169+
run: |
170+
export WEBDRIVER_PATH="${{ steps.setup-chrome.outputs.chromedriver-path }}"
171+
export BROWSER_PATH="${{ steps.setup-chrome.outputs.chrome-path }}"
172+
cargo test --workspace --features ${{ matrix.features }} --exclude plotly_kaleido
163173
164174
# Run tests on Windows with Chrome WebDriver
165175
- name: Run tests (${{ matrix.os }} - Chrome)

plotly_static/build.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,19 @@ fn setup_driver(config: &WebdriverDownloadConfig) -> Result<()> {
174174
match config.driver_name {
175175
CHROMEDRIVER_NAME => {
176176
let driver_info = ChromedriverInfo::new(webdriver_bin.clone(), browser_path);
177-
runtime
178-
.block_on(async { download_with_retry(&driver_info, false, true, 1).await })
179-
.with_context(|| {
180-
format!("Failed to download and install {}", config.driver_name)
181-
})?;
177+
let dl_res = runtime
178+
.block_on(async { download_with_retry(&driver_info, false, true, 1).await });
179+
if let Err(e) = dl_res {
180+
return Err(anyhow!("Failed to download and install chromedriver").context(e));
181+
}
182182
}
183183
GECKODRIVER_NAME => {
184184
let driver_info = GeckodriverInfo::new(webdriver_bin.clone(), browser_path);
185-
runtime
186-
.block_on(async { download_with_retry(&driver_info, false, true, 1).await })
187-
.with_context(|| {
188-
format!("Failed to download and install {}", config.driver_name)
189-
})?;
185+
let dl_res = runtime
186+
.block_on(async { download_with_retry(&driver_info, false, true, 1).await });
187+
if let Err(e) = dl_res {
188+
return Err(anyhow!("Failed to download and install geckodriver").context(e));
189+
}
190190
}
191191
_ => return Err(anyhow!("Unsupported driver type: {}", config.driver_name)),
192192
}

0 commit comments

Comments
 (0)