Skip to content

Commit

Permalink
Merge #527
Browse files Browse the repository at this point in the history
527: Check all feature combinations works properly on CI r=stjepang a=taiki-e

This adds a check for all feature combinations to CI.

*This originally suggested by @jonhoo in #504 (comment)

Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Jun 5, 2020
2 parents bbc8601 + 1ad6b9f commit 2f1ed42
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 45 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,27 @@ jobs:
- 1.36.0
- nightly
os:
- ubuntu
- windows
runs-on: ${{ matrix.os }}-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Test
run: ./ci/${{ matrix.crates }}.sh

# Check all feature combinations works properly.
check-features:
name: check-features
env:
RUST_VERSION: ${{ matrix.rust }}
strategy:
matrix:
rust:
- 1.36.0
- nightly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Install Rust
Expand All @@ -47,8 +65,8 @@ jobs:
run: |
rustup target add thumbv7m-none-eabi
rustup target add thumbv6m-none-eabi
- name: Test
run: ./ci/${{ matrix.crates }}.sh
- name: Check features
run: . ./ci/check-features.sh

# Check for duplicate dependencies.
dependencies:
Expand Down
27 changes: 27 additions & 0 deletions ci/check-features.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -ex

if [[ ! -x "$(command -v cargo-hack)" ]]; then
cargo install --debug cargo-hack || exit 1
fi

if [[ "$RUST_VERSION" != "nightly"* ]]; then
# On MSRV, features other than nightly should work.
# * `--feature-powerset` - run for the feature powerset which includes --no-default-features and default features of package
# * `--no-dev-deps` - build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
# * `--exclude benchmarks` - benchmarks doesn't published.
# * `--skip nightly` - skip `nightly` feature as requires nightly compilers.
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks --skip nightly
else
# On nightly, all feature combinations should work.
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks
# TODO(taiki-e): if https://github.com/taiki-e/cargo-hack/issues/42 merged, remove this.
cargo hack check --all --all-features --no-dev-deps --exclude benchmarks

# Check for no_std environment.
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks --target thumbv7m-none-eabi --skip std,default
# * `--features nightly` is required for enable `cfg_target_has_atomic`.
# * `--ignore-unknown-features` - some crates doesn't have 'nightly' feature
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks --target thumbv6m-none-eabi --skip std,default --features nightly --ignore-unknown-features
fi
2 changes: 1 addition & 1 deletion ci/crossbeam-channel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export RUSTFLAGS="-D warnings"
cargo check --bins --examples --tests
cargo test -- --test-threads=1

if [[ "$RUST_VERSION" == "nightly" ]]; then
if [[ "$RUST_VERSION" == "nightly"* ]]; then
cd benchmarks
cargo check --bins
fi
11 changes: 1 addition & 10 deletions ci/crossbeam-epoch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ set -ex

export RUSTFLAGS="-D warnings"

cargo check --no-default-features
cargo check --bins --examples --tests
cargo test

if [[ "$RUST_VERSION" == "nightly" ]]; then
cargo check --no-default-features --features nightly
if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

if [[ "$OSTYPE" == "linux"* ]]; then
Expand All @@ -22,11 +20,4 @@ if [[ "$RUST_VERSION" == "nightly" ]]; then
--features sanitize,nightly \
--example sanitize
fi

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
fi
1 change: 0 additions & 1 deletion ci/crossbeam-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ set -ex

export RUSTFLAGS="-D warnings"

cargo check --no-default-features
cargo check --bins --examples --tests
cargo test
11 changes: 1 addition & 10 deletions ci/crossbeam-skiplist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@ set -ex

export RUSTFLAGS="-D warnings"

cargo check --no-default-features
cargo check --bins --examples --tests
cargo test

if [[ "$RUST_VERSION" == "nightly" ]]; then
cargo check --no-default-features --features nightly
if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
fi
8 changes: 1 addition & 7 deletions ci/crossbeam-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ set -ex

export RUSTFLAGS="-D warnings"

cargo check --no-default-features
cargo check --bins --examples --tests
cargo test

if [[ "$RUST_VERSION" == "nightly" ]]; then
cargo check --no-default-features --features nightly
if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
fi
11 changes: 1 addition & 10 deletions ci/crossbeam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,9 @@ set -ex

export RUSTFLAGS="-D warnings"

cargo check --no-default-features
cargo check --bins --examples --tests
cargo test

if [[ "$RUST_VERSION" == "nightly" ]]; then
cargo check --no-default-features --features nightly
if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
fi
2 changes: 1 addition & 1 deletion crossbeam-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ alloc = []
# This is disabled by default and requires recent nightly compiler.
# Note that this is outside of the normal semver guarantees and minor versions
# of crossbeam may make breaking changes to them at any time.
nightly = []
nightly = ["crossbeam-utils/nightly"]

[dependencies]
cfg-if = "0.1.10"
Expand Down

0 comments on commit 2f1ed42

Please sign in to comment.