Skip to content

Commit

Permalink
Check all feature combinations works properly on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jun 5, 2020
1 parent bbc8601 commit cae71e1
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 44 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
28 changes: 28 additions & 0 deletions ci/check-features.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

cd "$(dirname "$0")"/..
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

0 comments on commit cae71e1

Please sign in to comment.