Skip to content

Commit 2f1ed42

Browse files
bors[bot]taiki-e
andauthored
Merge #527
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]>
2 parents bbc8601 + 1ad6b9f commit 2f1ed42

File tree

9 files changed

+56
-45
lines changed

9 files changed

+56
-45
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,27 @@ jobs:
3535
- 1.36.0
3636
- nightly
3737
os:
38-
- ubuntu
39-
- windows
40-
runs-on: ${{ matrix.os }}-latest
38+
- ubuntu-latest
39+
- windows-latest
40+
runs-on: ${{ matrix.os }}
41+
steps:
42+
- uses: actions/checkout@master
43+
- name: Install Rust
44+
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
45+
- name: Test
46+
run: ./ci/${{ matrix.crates }}.sh
47+
48+
# Check all feature combinations works properly.
49+
check-features:
50+
name: check-features
51+
env:
52+
RUST_VERSION: ${{ matrix.rust }}
53+
strategy:
54+
matrix:
55+
rust:
56+
- 1.36.0
57+
- nightly
58+
runs-on: ubuntu-latest
4159
steps:
4260
- uses: actions/checkout@master
4361
- name: Install Rust
@@ -47,8 +65,8 @@ jobs:
4765
run: |
4866
rustup target add thumbv7m-none-eabi
4967
rustup target add thumbv6m-none-eabi
50-
- name: Test
51-
run: ./ci/${{ matrix.crates }}.sh
68+
- name: Check features
69+
run: . ./ci/check-features.sh
5270

5371
# Check for duplicate dependencies.
5472
dependencies:

ci/check-features.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
if [[ ! -x "$(command -v cargo-hack)" ]]; then
6+
cargo install --debug cargo-hack || exit 1
7+
fi
8+
9+
if [[ "$RUST_VERSION" != "nightly"* ]]; then
10+
# On MSRV, features other than nightly should work.
11+
# * `--feature-powerset` - run for the feature powerset which includes --no-default-features and default features of package
12+
# * `--no-dev-deps` - build without dev-dependencies to avoid https://github.com/rust-lang/cargo/issues/4866
13+
# * `--exclude benchmarks` - benchmarks doesn't published.
14+
# * `--skip nightly` - skip `nightly` feature as requires nightly compilers.
15+
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks --skip nightly
16+
else
17+
# On nightly, all feature combinations should work.
18+
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks
19+
# TODO(taiki-e): if https://github.com/taiki-e/cargo-hack/issues/42 merged, remove this.
20+
cargo hack check --all --all-features --no-dev-deps --exclude benchmarks
21+
22+
# Check for no_std environment.
23+
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks --target thumbv7m-none-eabi --skip std,default
24+
# * `--features nightly` is required for enable `cfg_target_has_atomic`.
25+
# * `--ignore-unknown-features` - some crates doesn't have 'nightly' feature
26+
cargo hack check --all --feature-powerset --no-dev-deps --exclude benchmarks --target thumbv6m-none-eabi --skip std,default --features nightly --ignore-unknown-features
27+
fi

ci/crossbeam-channel.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export RUSTFLAGS="-D warnings"
88
cargo check --bins --examples --tests
99
cargo test -- --test-threads=1
1010

11-
if [[ "$RUST_VERSION" == "nightly" ]]; then
11+
if [[ "$RUST_VERSION" == "nightly"* ]]; then
1212
cd benchmarks
1313
cargo check --bins
1414
fi

ci/crossbeam-epoch.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ set -ex
55

66
export RUSTFLAGS="-D warnings"
77

8-
cargo check --no-default-features
98
cargo check --bins --examples --tests
109
cargo test
1110

12-
if [[ "$RUST_VERSION" == "nightly" ]]; then
13-
cargo check --no-default-features --features nightly
11+
if [[ "$RUST_VERSION" == "nightly"* ]]; then
1412
cargo test --features nightly
1513

1614
if [[ "$OSTYPE" == "linux"* ]]; then
@@ -22,11 +20,4 @@ if [[ "$RUST_VERSION" == "nightly" ]]; then
2220
--features sanitize,nightly \
2321
--example sanitize
2422
fi
25-
26-
# Check for no_std environment.
27-
cargo check --target thumbv7m-none-eabi --no-default-features
28-
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
29-
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
30-
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
31-
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
3223
fi

ci/crossbeam-queue.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ set -ex
55

66
export RUSTFLAGS="-D warnings"
77

8-
cargo check --no-default-features
98
cargo check --bins --examples --tests
109
cargo test

ci/crossbeam-skiplist.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,9 @@ set -ex
55

66
export RUSTFLAGS="-D warnings"
77

8-
cargo check --no-default-features
98
cargo check --bins --examples --tests
109
cargo test
1110

12-
if [[ "$RUST_VERSION" == "nightly" ]]; then
13-
cargo check --no-default-features --features nightly
11+
if [[ "$RUST_VERSION" == "nightly"* ]]; then
1412
cargo test --features nightly
15-
16-
# Check for no_std environment.
17-
cargo check --target thumbv7m-none-eabi --no-default-features
18-
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
19-
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
20-
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
21-
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
2213
fi

ci/crossbeam-utils.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ set -ex
55

66
export RUSTFLAGS="-D warnings"
77

8-
cargo check --no-default-features
98
cargo check --bins --examples --tests
109
cargo test
1110

12-
if [[ "$RUST_VERSION" == "nightly" ]]; then
13-
cargo check --no-default-features --features nightly
11+
if [[ "$RUST_VERSION" == "nightly"* ]]; then
1412
cargo test --features nightly
15-
16-
# Check for no_std environment.
17-
cargo check --target thumbv7m-none-eabi --no-default-features
18-
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
1913
fi

ci/crossbeam.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,9 @@ set -ex
55

66
export RUSTFLAGS="-D warnings"
77

8-
cargo check --no-default-features
98
cargo check --bins --examples --tests
109
cargo test
1110

12-
if [[ "$RUST_VERSION" == "nightly" ]]; then
13-
cargo check --no-default-features --features nightly
11+
if [[ "$RUST_VERSION" == "nightly"* ]]; then
1412
cargo test --features nightly
15-
16-
# Check for no_std environment.
17-
cargo check --target thumbv7m-none-eabi --no-default-features
18-
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
19-
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
20-
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
21-
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
2213
fi

crossbeam-queue/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ alloc = []
3131
# This is disabled by default and requires recent nightly compiler.
3232
# Note that this is outside of the normal semver guarantees and minor versions
3333
# of crossbeam may make breaking changes to them at any time.
34-
nightly = []
34+
nightly = ["crossbeam-utils/nightly"]
3535

3636
[dependencies]
3737
cfg-if = "0.1.10"

0 commit comments

Comments
 (0)