ci: use --feature-powerset --depth 2 in features check (#5007)

As has been pointed out a few times in the past (e.g., #4036 (comment)), each-feature 
is not sufficient for features check.

Ideally, we'd like to check all combinations of features, but there are too many
combinations. So limit the max number of simultaneous feature flags to 2 by --depth
option. I think this should be sufficient in most cases as @carllerche said in
taiki-e/cargo-hack#58.
This commit is contained in:
Taiki Endo
2022-09-13 11:05:38 -07:00
committed by GitHub
parent 0fddb765d4
commit b891714bdb
5 changed files with 17 additions and 23 deletions
+9 -12
View File
@@ -76,7 +76,7 @@ jobs:
run: rustup update stable run: rustup update stable
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Install cargo-hack - name: Install cargo-hack
run: cargo install cargo-hack uses: taiki-e/install-action@cargo-hack
# Run `tokio` with `full` features. This excludes testing utilities which # Run `tokio` with `full` features. This excludes testing utilities which
# can alter the runtime behavior of Tokio. # can alter the runtime behavior of Tokio.
@@ -279,14 +279,12 @@ jobs:
override: true override: true
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Install cargo-hack - name: Install cargo-hack
run: cargo install cargo-hack uses: taiki-e/install-action@cargo-hack
- name: check --each-feature - name: check --feature-powerset
run: cargo hack check --all --each-feature -Z avoid-dev-deps run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going
- name: check net,time
run: cargo check -p tokio --no-default-features --features net,time -Z avoid-dev-deps
# Try with unstable feature flags # Try with unstable feature flags
- name: check --each-feature --unstable - name: check --feature-powerset --unstable
run: cargo hack check --all --each-feature -Z avoid-dev-deps run: cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going
env: env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
@@ -316,7 +314,7 @@ jobs:
override: true override: true
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Install cargo-hack - name: Install cargo-hack
run: cargo install cargo-hack uses: taiki-e/install-action@cargo-hack
- name: "check --all-features -Z minimal-versions" - name: "check --all-features -Z minimal-versions"
run: | run: |
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update` # Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
@@ -501,13 +499,13 @@ jobs:
# Install dependencies # Install dependencies
- name: Install cargo-hack - name: Install cargo-hack
run: cargo install cargo-hack uses: taiki-e/install-action@cargo-hack
- name: Install wasm32-wasi target - name: Install wasm32-wasi target
run: rustup target add wasm32-wasi run: rustup target add wasm32-wasi
- name: Install wasmtime - name: Install wasmtime
run: cargo install wasmtime-cli uses: taiki-e/install-action@wasmtime
- name: Install cargo-wasi - name: Install cargo-wasi
run: cargo install cargo-wasi run: cargo install cargo-wasi
@@ -557,4 +555,3 @@ jobs:
cargo install cargo-check-external-types --locked --version 0.1.3 cargo install cargo-check-external-types --locked --version 0.1.3
cargo check-external-types --all-features --config external-types.toml cargo check-external-types --all-features --config external-types.toml
working-directory: tokio working-directory: tokio
+2 -2
View File
@@ -28,8 +28,8 @@ impl Driver {
} }
} }
pub(crate) fn handle(&self) -> Handle { pub(crate) fn unpark(&self) -> Handle {
self.park.io_handle() self.park.unpark()
} }
pub(crate) fn park(&mut self) { pub(crate) fn park(&mut self) {
+2 -1
View File
@@ -43,7 +43,7 @@ cfg_io_driver! {
impl IoStack { impl IoStack {
pub(crate) fn unpark(&self) -> IoUnpark { pub(crate) fn unpark(&self) -> IoUnpark {
match self { match self {
IoStack::Enabled(v) => IoUnpark::Enabled(v.handle()), IoStack::Enabled(v) => IoUnpark::Enabled(v.unpark()),
IoStack::Disabled(v) => IoUnpark::Disabled(v.unpark()), IoStack::Disabled(v) => IoUnpark::Disabled(v.unpark()),
} }
} }
@@ -62,6 +62,7 @@ cfg_io_driver! {
} }
} }
#[cfg_attr(not(feature = "rt-multi-thread"), allow(dead_code))] // some features use this
pub(crate) fn shutdown(&mut self) { pub(crate) fn shutdown(&mut self) {
match self { match self {
IoStack::Enabled(v) => v.shutdown(), IoStack::Enabled(v) => v.shutdown(),
+2 -6
View File
@@ -145,12 +145,8 @@ impl Driver {
} }
// TODO: remove this in a later refactor // TODO: remove this in a later refactor
cfg_not_rt! { pub(crate) fn unpark(&self) -> Handle {
cfg_time! { self.handle()
pub(crate) fn unpark(&self) -> Handle {
self.handle()
}
}
} }
pub(crate) fn park(&mut self) { pub(crate) fn park(&mut self) {
+2 -2
View File
@@ -92,8 +92,8 @@ impl Driver {
} }
} }
pub(crate) fn io_handle(&self) -> io::Handle { pub(crate) fn unpark(&self) -> io::Handle {
self.park.handle() self.park.unpark()
} }
pub(crate) fn park(&mut self) { pub(crate) fn park(&mut self) {