Skip to content

Commit

Permalink
Test more feature flag combinations in CI (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Jun 8, 2022
1 parent ba38ebe commit 75f9b49
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 260 deletions.
106 changes: 33 additions & 73 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,42 @@ jobs:
# run tests on all workspace members with default feature list
cargo test
# Switch to arrow crate
cd arrow
# re-run tests on arrow crate to ensure
# all arrays are created correctly
cargo test --features=force_validate
cargo test --features=prettyprint
# run test on arrow crate with minimal set of features
cargo test --no-default-features
# re-run tests on arrow crate with all supported features
cargo test -p arrow --features=force_validate,prettyprint
# Test arrow examples
cargo run --example builders
cargo run --example dynamic_types
cargo run --example read_csv
cargo run --example read_csv_infer_schema
cargo check --no-default-features
# Test compilation of arrow library crate with different feature combinations
cargo check -p arrow
cargo check -p arrow --no-default-features
# Test compilation of arrow targets with different feature combinations
cargo check -p arrow --all-targets
cargo check -p arrow --no-default-features --all-targets
# Switch to parquet crate
cd ../parquet
# re-run tests on parquet crate with async feature enabled
cargo test --features=async
cargo check --no-default-features
# re-run tests on arrow-flight with all features
cargo test -p arrow-flight --all-features
# Switch to arrow-flight
cd ../arrow-flight
cargo test --features=flight-sql-experimental
cargo check --no-default-features
# re-run tests on parquet crate with all features
cargo test -p parquet --all-features
# Test compilation of parquet library crate with different feature combinations
cargo check -p parquet
cargo check -p parquet --no-default-features
cargo check -p parquet --no-default-features --features arrow
# Test compilation of parquet targets with different feature combinations
cargo check -p parquet --all-targets
cargo check -p parquet --no-default-features --all-targets
cargo check -p parquet --no-default-features --features arrow --all-targets
# Test compilation of parquet_derive macro with different feature combinations
cargo check -p parquet_derive
# test the --features "simd" of the arrow crate. This requires nightly.
linux-test-simd:
Expand Down Expand Up @@ -173,12 +184,12 @@ jobs:
export CARGO_TARGET_DIR="/github/home/target"
cd arrow
cargo test --features "simd"
- name: Check new project build with simd features
- name: Check compilation with simd features
run: |
export CARGO_HOME="/github/home/.cargo"
export CARGO_TARGET_DIR="/github/home/target"
cd arrow/test/dependency/simd
cargo check
cargo check -p arrow --features simd
cargo check -p arrow --features simd --all-targets
windows-and-macos:
name: Test on ${{ matrix.os }} Rust ${{ matrix.rust }}
Expand Down Expand Up @@ -435,54 +446,3 @@ jobs:
export CARGO_TARGET_DIR="/github/home/target"
export RUSTDOCFLAGS="-Dwarnings"
cargo doc --document-private-items --no-deps --workspace --all-features
# test builds with various feature flag combinations outside the main workspace
default-build:
name: Feature Flag Builds ${{ matrix.rust }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64]
rust: [stable]
container:
image: ${{ matrix.arch }}/rust
env:
# Disable debug symbol generation to speed up CI build and keep memory down
RUSTFLAGS: "-C debuginfo=0"
steps:
- uses: actions/checkout@v2
- name: Cache Cargo
uses: actions/cache@v3
with:
path: /github/home/.cargo
# this key equals the ones on `linux-build-lib` for re-use
key: cargo-cache3-
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: /github/home/target
# this key equals the ones on `linux-build-lib` for re-use
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache3-${{ matrix.rust }}
- name: Setup Rust toolchain
uses: ./.github/actions/setup-builder
with:
rust-version: ${{ matrix.rust }}
- name: Arrow Build with default features
run: |
export CARGO_HOME="/github/home/.cargo"
export CARGO_TARGET_DIR="/github/home/target"
cd arrow/test/dependency/default-features
cargo check
- name: Arrow Build with default-features=false
run: |
export CARGO_HOME="/github/home/.cargo"
export CARGO_TARGET_DIR="/github/home/target"
cd arrow/test/dependency/no-default-features
cargo check
- name: Parquet Derive build with default-features
run: |
export CARGO_HOME="/github/home/.cargo"
export CARGO_TARGET_DIR="/github/home/target"
cd parquet_derive/test/dependency/default-features
cargo check
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ members = [
"arrow-flight",
"integration-testing",
]
resolver = "2"

# this package is excluded because it requires different compilation flags, thereby significantly changing
# how it is compiled within the workspace, causing the whole workspace to be compiled from scratch
Expand Down
21 changes: 0 additions & 21 deletions arrow/test/dependency/README.md

This file was deleted.

30 changes: 0 additions & 30 deletions arrow/test/dependency/default-features/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions arrow/test/dependency/default-features/src/main.rs

This file was deleted.

30 changes: 0 additions & 30 deletions arrow/test/dependency/no-default-features/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions arrow/test/dependency/no-default-features/src/main.rs

This file was deleted.

30 changes: 0 additions & 30 deletions arrow/test/dependency/simd/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions arrow/test/dependency/simd/src/main.rs

This file was deleted.

17 changes: 12 additions & 5 deletions parquet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,44 @@ brotli = { version = "3.3", optional = true }
flate2 = { version = "1.0", optional = true }
lz4 = { version = "1.23", optional = true }
zstd = { version = "0.11.1", optional = true, default-features = false }
chrono = { version = "0.4", default-features = false }
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
num = "0.4"
num-bigint = "0.4"
arrow = { path = "../arrow", version = "15.0.0", optional = true, default-features = false, features = ["ipc"] }
base64 = { version = "0.13", optional = true }
clap = { version = "3", optional = true, features = ["derive", "env"] }
serde_json = { version = "1.0", features = ["preserve_order"], optional = true }
serde_json = { version = "1.0", optional = true }
rand = "0.8"
futures = { version = "0.3", optional = true }
tokio = { version = "1.0", optional = true, default-features = false, features = ["macros", "fs", "rt", "io-util"] }

[dev-dependencies]
base64 = "0.13"
criterion = "0.3"
rand = "0.8"
snap = "1.0"
tempfile = "3.0"
brotli = "3.3"
flate2 = "1.0"
lz4 = "1.23"
zstd = "0.11"
serde_json = { version = "1.0", features = ["preserve_order"] }
arrow = { path = "../arrow", version = "15.0.0", default-features = false, features = ["test_utils", "prettyprint"] }
arrow = { path = "../arrow", version = "15.0.0", default-features = false, features = ["ipc", "test_utils", "prettyprint"] }

[package.metadata.docs.rs]
all-features = true

[features]
default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64"]
# Enable arrow reader/writer APIs
arrow = ["dep:arrow", "base64"]
# Enable CLI tools
cli = ["serde_json", "base64", "clap"]
# Enable internal testing APIs
test_common = []
# Experimental, unstable functionality primarily used for testing
experimental = []
# Enable async API
# Enable async APIs
async = ["futures", "tokio"]

[[bin]]
Expand All @@ -87,11 +93,12 @@ required-features = ["cli"]

[[bench]]
name = "arrow_writer"
required-features = ["arrow"]
harness = false

[[bench]]
name = "arrow_reader"
required-features = ["test_common", "experimental"]
required-features = ["arrow", "test_common", "experimental"]
harness = false

[lib]
Expand Down
2 changes: 1 addition & 1 deletion parquet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ See [crate documentation](https://docs.rs/parquet/latest/parquet/) for examples

## Rust Version Compatbility

This crate is tested with the latest stable version of Rust. We do not currrently test against other, older versions of the Rust compiler.
This crate is tested with the latest stable version of Rust. We do not currently test against other, older versions of the Rust compiler.

## Features

Expand Down
5 changes: 3 additions & 2 deletions parquet/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

//! Common Parquet errors and macros.
use std::{cell, convert, io, result, str};
use std::{cell, io, result, str};

#[cfg(any(feature = "arrow", test))]
use arrow::error::ArrowError;
Expand Down Expand Up @@ -108,7 +108,7 @@ pub type Result<T> = result::Result<T, ParquetError>;
// ----------------------------------------------------------------------
// Conversion from `ParquetError` to other types of `Error`s

impl convert::From<ParquetError> for io::Error {
impl From<ParquetError> for io::Error {
fn from(e: ParquetError) -> Self {
io::Error::new(io::ErrorKind::Other, e)
}
Expand All @@ -135,6 +135,7 @@ macro_rules! eof_err {
($fmt:expr, $($args:expr),*) => (ParquetError::EOF(format!($fmt, $($args),*)));
}

#[cfg(any(feature = "arrow", test))]
macro_rules! arrow_err {
($fmt:expr) => (ParquetError::ArrowError($fmt.to_owned()));
($fmt:expr, $($args:expr),*) => (ParquetError::ArrowError(format!($fmt, $($args),*)));
Expand Down
Loading

0 comments on commit 75f9b49

Please sign in to comment.