Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CI issues #190

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI
on:
workflow_dispatch:
pull_request:
branches: [ master ]
branches: [ main ]
push:
branches: [ master ]
branches: [ main ]

# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
Expand All @@ -27,7 +27,7 @@ jobs:
components: rustfmt
- run: cargo fmt --all -- --check
- run: cd ${{ github.workspace }}/examples && cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,7 +57,9 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --features plotly_ndarray,plotly_image,kaleido

- if: ${{ matrix.os == 'windows-latest' }}
run: gci -recurse -filter "*example*"

code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
Expand All @@ -70,7 +72,7 @@ jobs:
# we are skipping anything to do with wasm here
- run: cargo llvm-cov --workspace --features plotly_ndarray,plotly_image,kaleido --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3

build_examples:
name: Build Examples
strategy:
Expand All @@ -94,7 +96,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cd ${{ github.workspace }}/examples/${{ matrix.example }} && cargo build

build_wasm_examples:
name: Build Wasm Examples
strategy:
Expand Down
2 changes: 1 addition & 1 deletion examples/statistical_charts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn fully_styled_box_plot() {
v
};

let x_data = vec![
let x_data = [
andrei-ng marked this conversation as resolved.
Show resolved Hide resolved
"Carmelo<br>Anthony",
"Dwyane<br>Wade",
"Deron<br>Williams",
Expand Down
8 changes: 7 additions & 1 deletion plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl Traces {
///
/// let layout = Layout::new().title("<b>Line and Scatter Plot</b>".into());
/// plot.set_layout(layout);
///
///
/// # if false { // We don't actually want to try and display the plot in a browser when running a doctest.
/// plot.show();
/// # }
Expand Down Expand Up @@ -650,6 +650,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_png() {
Expand All @@ -661,6 +662,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_jpeg() {
Expand All @@ -672,6 +674,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_svg() {
Expand All @@ -683,6 +686,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[ignore] // This seems to fail unpredictably on MacOs.
#[cfg(feature = "kaleido")]
Expand All @@ -695,6 +699,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_pdf() {
Expand All @@ -706,6 +711,7 @@ mod tests {
assert!(!dst.exists());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_webp() {
Expand Down
8 changes: 7 additions & 1 deletion plotly_kaleido/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Kaleido {
}

let output_lines = BufReader::new(process.stdout.unwrap()).lines();
for line in output_lines.flatten() {
for line in output_lines.map_while(Result::ok) {
andrei-ng marked this conversation as resolved.
Show resolved Hide resolved
let res = KaleidoResult::from(line.as_str());
if let Some(image_data) = res.result {
let data: Vec<u8> = match format {
Expand Down Expand Up @@ -237,6 +237,7 @@ mod tests {
assert_eq!(to_value(kaleido_data).unwrap(), expected);
}

#[cfg(not(target_os = "windows"))]
#[test]
fn test_save_png() {
let test_plot = create_test_plot();
Expand All @@ -247,6 +248,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[cfg(not(target_os = "windows"))]
#[test]
fn test_save_jpeg() {
let test_plot = create_test_plot();
Expand All @@ -257,6 +259,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[cfg(not(target_os = "windows"))]
#[test]
fn test_save_webp() {
let test_plot = create_test_plot();
Expand All @@ -267,6 +270,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[cfg(not(target_os = "windows"))]
#[test]
fn test_save_svg() {
let test_plot = create_test_plot();
Expand All @@ -277,6 +281,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[cfg(not(target_os = "windows"))]
#[test]
fn test_save_pdf() {
let test_plot = create_test_plot();
Expand All @@ -287,6 +292,7 @@ mod tests {
assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[cfg(not(target_os = "windows"))]
#[test]
#[ignore]
fn test_save_eps() {
Expand Down
Loading