Skip to content

Commit 376f38e

Browse files
committed
Test more feature flag combinations in CI (#1630)
1 parent ba38ebe commit 376f38e

File tree

16 files changed

+51
-260
lines changed

16 files changed

+51
-260
lines changed

.github/workflows/rust.yml

Lines changed: 30 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -108,31 +108,39 @@ jobs:
108108
109109
# run tests on all workspace members with default feature list
110110
cargo test
111-
112-
# Switch to arrow crate
113-
cd arrow
114-
# re-run tests on arrow crate to ensure
115-
# all arrays are created correctly
116-
cargo test --features=force_validate
117-
cargo test --features=prettyprint
118-
# run test on arrow crate with minimal set of features
119-
cargo test --no-default-features
111+
112+
# re-run tests on arrow crate with all supported features
113+
cargo test -p arrow --features=force_validate,prettyprint
114+
115+
# Test arrow examples
120116
cargo run --example builders
121117
cargo run --example dynamic_types
122118
cargo run --example read_csv
123119
cargo run --example read_csv_infer_schema
124-
cargo check --no-default-features
120+
121+
# Test compilation of arrow library crate with different feature combinations
122+
cargo check -p arrow
123+
cargo check -p arrow --no-default-features
124+
125+
# Test compilation of arrow targets with different feature combinations
126+
cargo check -p arrow --all-targets
127+
cargo check -p arrow --no-default-features --all-targets
125128
126-
# Switch to parquet crate
127-
cd ../parquet
128-
# re-run tests on parquet crate with async feature enabled
129-
cargo test --features=async
130-
cargo check --no-default-features
129+
# re-run tests on parquet crate with all features
130+
cargo test -p parquet --all-features
131+
132+
# Test compilation of parquet library crate with different feature combinations
133+
cargo check -p parquet
134+
cargo check -p parquet --no-default-features
135+
cargo check -p parquet --no-default-features --features arrow
136+
137+
# Test compilation of parquet targets with different feature combinations
138+
cargo check -p parquet --all-targets
139+
cargo check -p parquet --no-default-features --all-targets
140+
cargo check -p parquet --no-default-features --features arrow --all-targets
131141
132-
# Switch to arrow-flight
133-
cd ../arrow-flight
134-
cargo test --features=flight-sql-experimental
135-
cargo check --no-default-features
142+
# re-run tests on arrow-flight with all features
143+
cargo test -p arrow-flight --all-features
136144
137145
# test the --features "simd" of the arrow crate. This requires nightly.
138146
linux-test-simd:
@@ -173,12 +181,12 @@ jobs:
173181
export CARGO_TARGET_DIR="/github/home/target"
174182
cd arrow
175183
cargo test --features "simd"
176-
- name: Check new project build with simd features
184+
- name: Check compilation with simd features
177185
run: |
178186
export CARGO_HOME="/github/home/.cargo"
179187
export CARGO_TARGET_DIR="/github/home/target"
180-
cd arrow/test/dependency/simd
181-
cargo check
188+
cargo check -p arrow --features simd
189+
cargo check -p arrow --features simd --all-targets
182190
183191
windows-and-macos:
184192
name: Test on ${{ matrix.os }} Rust ${{ matrix.rust }}
@@ -435,54 +443,3 @@ jobs:
435443
export CARGO_TARGET_DIR="/github/home/target"
436444
export RUSTDOCFLAGS="-Dwarnings"
437445
cargo doc --document-private-items --no-deps --workspace --all-features
438-
439-
440-
# test builds with various feature flag combinations outside the main workspace
441-
default-build:
442-
name: Feature Flag Builds ${{ matrix.rust }}
443-
runs-on: ubuntu-latest
444-
strategy:
445-
matrix:
446-
arch: [amd64]
447-
rust: [stable]
448-
container:
449-
image: ${{ matrix.arch }}/rust
450-
env:
451-
# Disable debug symbol generation to speed up CI build and keep memory down
452-
RUSTFLAGS: "-C debuginfo=0"
453-
steps:
454-
- uses: actions/checkout@v2
455-
- name: Cache Cargo
456-
uses: actions/cache@v3
457-
with:
458-
path: /github/home/.cargo
459-
# this key equals the ones on `linux-build-lib` for re-use
460-
key: cargo-cache3-
461-
- name: Cache Rust dependencies
462-
uses: actions/cache@v3
463-
with:
464-
path: /github/home/target
465-
# this key equals the ones on `linux-build-lib` for re-use
466-
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache3-${{ matrix.rust }}
467-
- name: Setup Rust toolchain
468-
uses: ./.github/actions/setup-builder
469-
with:
470-
rust-version: ${{ matrix.rust }}
471-
- name: Arrow Build with default features
472-
run: |
473-
export CARGO_HOME="/github/home/.cargo"
474-
export CARGO_TARGET_DIR="/github/home/target"
475-
cd arrow/test/dependency/default-features
476-
cargo check
477-
- name: Arrow Build with default-features=false
478-
run: |
479-
export CARGO_HOME="/github/home/.cargo"
480-
export CARGO_TARGET_DIR="/github/home/target"
481-
cd arrow/test/dependency/no-default-features
482-
cargo check
483-
- name: Parquet Derive build with default-features
484-
run: |
485-
export CARGO_HOME="/github/home/.cargo"
486-
export CARGO_TARGET_DIR="/github/home/target"
487-
cd parquet_derive/test/dependency/default-features
488-
cargo check

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ members = [
2424
"arrow-flight",
2525
"integration-testing",
2626
]
27+
resolver = "2"
2728

2829
# this package is excluded because it requires different compilation flags, thereby significantly changing
2930
# how it is compiled within the workspace, causing the whole workspace to be compiled from scratch

arrow/test/dependency/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

arrow/test/dependency/default-features/Cargo.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

arrow/test/dependency/default-features/src/main.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

arrow/test/dependency/no-default-features/Cargo.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

arrow/test/dependency/no-default-features/src/main.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

arrow/test/dependency/simd/Cargo.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

arrow/test/dependency/simd/src/main.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.

parquet/Cargo.toml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,44 @@ brotli = { version = "3.3", optional = true }
3939
flate2 = { version = "1.0", optional = true }
4040
lz4 = { version = "1.23", optional = true }
4141
zstd = { version = "0.11.1", optional = true, default-features = false }
42-
chrono = { version = "0.4", default-features = false }
42+
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
4343
num = "0.4"
4444
num-bigint = "0.4"
4545
arrow = { path = "../arrow", version = "15.0.0", optional = true, default-features = false, features = ["ipc"] }
4646
base64 = { version = "0.13", optional = true }
4747
clap = { version = "3", optional = true, features = ["derive", "env"] }
48-
serde_json = { version = "1.0", features = ["preserve_order"], optional = true }
48+
serde_json = { version = "1.0", optional = true }
4949
rand = "0.8"
5050
futures = { version = "0.3", optional = true }
5151
tokio = { version = "1.0", optional = true, default-features = false, features = ["macros", "fs", "rt", "io-util"] }
5252

5353
[dev-dependencies]
54+
base64 = "0.13"
5455
criterion = "0.3"
5556
rand = "0.8"
5657
snap = "1.0"
5758
tempfile = "3.0"
5859
brotli = "3.3"
5960
flate2 = "1.0"
6061
lz4 = "1.23"
62+
zstd = "0.11"
6163
serde_json = { version = "1.0", features = ["preserve_order"] }
62-
arrow = { path = "../arrow", version = "15.0.0", default-features = false, features = ["test_utils", "prettyprint"] }
64+
arrow = { path = "../arrow", version = "15.0.0", default-features = false, features = ["ipc", "test_utils", "prettyprint"] }
6365

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

6769
[features]
6870
default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64"]
71+
# Enable arrow reader/writer APIs
72+
arrow = ["dep:arrow", "base64"]
73+
# Enable CLI tools
6974
cli = ["serde_json", "base64", "clap"]
75+
# Enable internal testing APIs
7076
test_common = []
7177
# Experimental, unstable functionality primarily used for testing
7278
experimental = []
73-
# Enable async API
79+
# Enable async APIs
7480
async = ["futures", "tokio"]
7581

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

8894
[[bench]]
8995
name = "arrow_writer"
96+
required-features = ["arrow"]
9097
harness = false
9198

9299
[[bench]]
93100
name = "arrow_reader"
94-
required-features = ["test_common", "experimental"]
101+
required-features = ["arrow", "test_common", "experimental"]
95102
harness = false
96103

97104
[lib]

parquet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See [crate documentation](https://docs.rs/parquet/latest/parquet/) for examples
2727

2828
## Rust Version Compatbility
2929

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

3232
## Features
3333

parquet/src/errors.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
//! Common Parquet errors and macros.
1919
20-
use std::{cell, convert, io, result, str};
20+
use std::{cell, io, result, str};
2121

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

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

138+
#[cfg(any(feature = "arrow", test))]
138139
macro_rules! arrow_err {
139140
($fmt:expr) => (ParquetError::ArrowError($fmt.to_owned()));
140141
($fmt:expr, $($args:expr),*) => (ParquetError::ArrowError(format!($fmt, $($args),*)));

parquet/src/record/api.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::data_type::{ByteArray, Decimal, Int96};
2727
use crate::errors::{ParquetError, Result};
2828
use crate::schema::types::ColumnDescPtr;
2929

30-
#[cfg(feature = "cli")]
30+
#[cfg(any(feature = "cli", test))]
3131
use serde_json::Value;
3232

3333
/// Macro as a shortcut to generate 'not yet implemented' panic error.
@@ -79,7 +79,7 @@ impl Row {
7979
}
8080
}
8181

82-
#[cfg(feature = "cli")]
82+
#[cfg(any(feature = "cli", test))]
8383
pub fn to_json_value(&self) -> Value {
8484
Value::Object(
8585
self.fields
@@ -650,7 +650,7 @@ impl Field {
650650
}
651651
}
652652

653-
#[cfg(feature = "cli")]
653+
#[cfg(any(feature = "cli", test))]
654654
pub fn to_json_value(&self) -> Value {
655655
match &self {
656656
Field::Null => Value::Null,
@@ -1668,7 +1668,7 @@ mod tests {
16681668
}
16691669

16701670
#[test]
1671-
#[cfg(feature = "cli")]
1671+
#[cfg(any(feature = "cli", test))]
16721672
fn test_to_json_value() {
16731673
assert_eq!(Field::Null.to_json_value(), Value::Null);
16741674
assert_eq!(Field::Bool(true).to_json_value(), Value::Bool(true));

0 commit comments

Comments
 (0)