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

Add tests for building applications using arrow with different feature flags #532

Merged
merged 2 commits into from
Jul 12, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 16 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ jobs:
rustup component add rustfmt
- name: Run
run: cargo fmt --all -- --check

coverage:
name: Coverage
runs-on: ubuntu-latest
Expand Down Expand Up @@ -327,9 +328,9 @@ jobs:
cd arrow
cargo build --target wasm32-unknown-unknown

# test the projects can build without default features
# test builds with various feature flags
default-build:
name: Check No Defaults on AMD64 Rust ${{ matrix.rust }}
name: Arrow Feature Flag Builds ${{ matrix.rust }}
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -338,15 +339,10 @@ jobs:
container:
image: ${{ matrix.arch }}/rust
env:
# Disable full debug symbol generation to speed up CI build and keep memory down
# "1" means line tables only, which is useful for panic tracebacks.
RUSTFLAGS: "-C debuginfo=1"
ARROW_TEST_DATA: /__w/arrow-rs/arrow-rs/testing/data
PARQUET_TEST_DATA: /__w/arrow/arrow/parquet-testing/data
# Disable debug symbol generation to speed up CI build and keep memory down
RUSTFLAGS: "-C debuginfo=0"
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Cache Cargo
uses: actions/cache@v2
with:
Expand All @@ -357,15 +353,22 @@ jobs:
uses: actions/cache@v2
with:
path: /github/home/target
key: ${{ runner.os }}-${{ matrix.arch }}-target-wasm32-cache-${{ matrix.rust }}
# this key equals the ones on `linux-build-lib` for re-use
key: ${{ runner.os }}-${{ matrix.arch }}-target-cache-${{ matrix.rust }}
- name: Setup Rust toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup override set ${{ matrix.rust }}
rustup component add rustfmt
- name: Build arrow crate
- name: Build with default features
run: |
export CARGO_HOME="/github/home/.cargo"
export CARGO_TARGET_DIR="/github/home/target"
cd arrow
cargo check --all-targets --no-default-features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be what was missing ito catching other feature types? That we weren't running cargo check --all-targets --features simd,...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason CI isn't catching issues with feature flags is due to the cargo semantics of a workspace -- where Cargo tries to calculate the dependency needs of the workspace as a whole. Since we have some crates in the workspace (like arrow-flight) that bring in additional dependencies, these additional dependencies can obscure build problems with other crates (like arrow) when used alone

cd arrow/test/dependency/default-features
cargo check
- name: 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
21 changes: 21 additions & 0 deletions arrow/test/dependency/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

This directory contains projects that use arrow as a dependency with
various combinations of feature flags.
32 changes: 32 additions & 0 deletions arrow/test/dependency/default-features/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[package]
name = "defeault-features"
description = "Models a user application of arrow that uses default features of arrow"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrow = { path = "../../../../arrow", version = "5.0.0-SNAPSHOT" }

# Workaround for https://github.com/apache/arrow-rs/issues/529
rand = { version = "0.8" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this line is removed the test fails. I will remove it with the fix for #529


[workspace]
3 changes: 3 additions & 0 deletions arrow/test/dependency/default-features/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
32 changes: 32 additions & 0 deletions arrow/test/dependency/no-default-features/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[package]
name = "no-default-features"
description = "Models a user application of arrow that specifies no-default-features=true"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
arrow = { path = "../../../../arrow", version = "5.0.0-SNAPSHOT", default-features = false }

# Workaround for https://github.com/apache/arrow-rs/issues/529
rand = { version = "0.8" }

[workspace]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is required (you get a cargo build error without it). Somehow this signals to cargo that this project is not part of the workspace rooted at arrow-rs/Cargo.toml

3 changes: 3 additions & 0 deletions arrow/test/dependency/no-default-features/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
1 change: 1 addition & 0 deletions dev/release/rat_exclude_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ testing/*
target/*
dev/release/rat_exclude_files.txt
arrow/test/data/*
arrow/test/dependency/*
.gitattributes
**.gitignore
.gitmodules
Expand Down