diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1b64f348..1b5532391 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: diff --git a/ci/check-features.sh b/ci/check-features.sh new file mode 100644 index 000000000..cf3ef5a50 --- /dev/null +++ b/ci/check-features.sh @@ -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 diff --git a/ci/crossbeam-channel.sh b/ci/crossbeam-channel.sh index def0c72f3..7820f6cde 100755 --- a/ci/crossbeam-channel.sh +++ b/ci/crossbeam-channel.sh @@ -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 diff --git a/ci/crossbeam-epoch.sh b/ci/crossbeam-epoch.sh index dc42ba39d..7c9fd8ec2 100755 --- a/ci/crossbeam-epoch.sh +++ b/ci/crossbeam-epoch.sh @@ -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 @@ -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 diff --git a/ci/crossbeam-queue.sh b/ci/crossbeam-queue.sh index f8f180fd3..d11faeccf 100755 --- a/ci/crossbeam-queue.sh +++ b/ci/crossbeam-queue.sh @@ -5,6 +5,5 @@ set -ex export RUSTFLAGS="-D warnings" -cargo check --no-default-features cargo check --bins --examples --tests cargo test diff --git a/ci/crossbeam-skiplist.sh b/ci/crossbeam-skiplist.sh index 3c4ee95e9..dbbd2cede 100755 --- a/ci/crossbeam-skiplist.sh +++ b/ci/crossbeam-skiplist.sh @@ -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 diff --git a/ci/crossbeam-utils.sh b/ci/crossbeam-utils.sh index 4c7af5ee0..5228a59f3 100755 --- a/ci/crossbeam-utils.sh +++ b/ci/crossbeam-utils.sh @@ -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 diff --git a/ci/crossbeam.sh b/ci/crossbeam.sh index 42c18dfb9..4eb1773d7 100755 --- a/ci/crossbeam.sh +++ b/ci/crossbeam.sh @@ -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 diff --git a/crossbeam-queue/Cargo.toml b/crossbeam-queue/Cargo.toml index ea2880c29..bd090e7ce 100644 --- a/crossbeam-queue/Cargo.toml +++ b/crossbeam-queue/Cargo.toml @@ -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"