Skip to content

Commit a623604

Browse files
ci: use preinstalled browser binaries
Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
1 parent 9253549 commit a623604

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
with:
3939
chrome-version: 'latest'
4040
install-chromedriver: true
41+
id: setup-chrome
4142
- uses: dtolnay/rust-toolchain@stable
4243
with:
4344
components: clippy

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 =
178+
runtime.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 =
186+
runtime.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
}

plotly_static/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ impl StaticExporter {
778778
/// # Examples
779779
///
780780
/// ```no_run
781-
///
781+
///
782782
/// // This example requires a running WebDriver (chromedriver/geckodriver) and a browser.
783783
/// // It cannot be run as a doc test.
784784
///
@@ -841,7 +841,7 @@ impl StaticExporter {
841841
/// # Examples
842842
///
843843
/// ```no_run
844-
///
844+
///
845845
/// // This example requires a running WebDriver (chromedriver/geckodriver) and a browser.
846846
/// // It cannot be run as a doc test.
847847
/// use plotly_static::{StaticExporterBuilder, ImageFormat};

0 commit comments

Comments
 (0)