29
29
# - tokio-test/Cargo.toml
30
30
# - tokio-stream/Cargo.toml
31
31
rust_min : ' 1.70'
32
+ # This excludes unstable features like io_uring,
33
+ # which require '--cfg tokio_unstable'.
34
+ TOKIO_STABLE_FEATURES : " full,test-util"
32
35
33
36
defaults :
34
37
run :
@@ -73,15 +76,13 @@ jobs:
73
76
74
77
- uses : Swatinem/rust-cache@v2
75
78
76
- # Run `tokio` with `full` features. This excludes testing utilities which
79
+ # Run `tokio` with stable features. This excludes testing utilities which
77
80
# can alter the runtime behavior of Tokio.
78
81
- name : test tokio full
79
82
run : |
80
83
set -euxo pipefail
81
- # We use `--features "full,test-util"` instead of `--all-features` since
82
- # `--all-features` includes `io_uring`, which is not available on all targets.
83
- cargo nextest run --features full,test-util
84
- cargo test --doc --features full,test-util
84
+ cargo nextest run --features full
85
+ cargo test --doc --features full
85
86
working-directory : tokio
86
87
87
88
test-workspace-all-features :
@@ -107,12 +108,11 @@ jobs:
107
108
108
109
- uses : Swatinem/rust-cache@v2
109
110
110
- # Test **all** crates in the workspace with all features.
111
- - name : test all --all-features
111
+ - name : test --features ${{ env.TOKIO_STABLE_FEATURES }}
112
112
run : |
113
113
set -euxo pipefail
114
- cargo nextest run --workspace --all- features
115
- cargo test --doc --workspace --all- features
114
+ cargo nextest run --workspace --features $TOKIO_STABLE_FEATURES
115
+ cargo test --doc --workspace --features $TOKIO_STABLE_FEATURES
116
116
117
117
test-workspace-all-features-panic-abort :
118
118
needs : basics
@@ -137,10 +137,15 @@ jobs:
137
137
138
138
- uses : Swatinem/rust-cache@v2
139
139
140
- - name : test all --all- features panic=abort
140
+ - name : test -- features ${{ env.TOKIO_STABLE_FEATURES }} panic=abort
141
141
run : |
142
142
set -euxo pipefail
143
- RUSTFLAGS="$RUSTFLAGS -C panic=abort -Zpanic-abort-tests" cargo nextest run --workspace --exclude tokio-macros --exclude tests-build --all-features --tests
143
+ RUSTFLAGS="$RUSTFLAGS -C panic=abort -Zpanic-abort-tests" cargo nextest run \
144
+ --workspace \
145
+ --exclude tokio-macros \
146
+ --exclude tests-build \
147
+ --features $TOKIO_STABLE_FEATURES \
148
+ --tests
144
149
145
150
test-integration-tests-per-feature :
146
151
needs : basics
@@ -204,8 +209,9 @@ jobs:
204
209
run : sed -i '/\[features\]/a plsend = ["parking_lot/send_guard"]' tokio/Cargo.toml
205
210
206
211
- uses : Swatinem/rust-cache@v2
207
- - name : Check tests with all features enabled
208
- run : cargo check --workspace --all-features --tests
212
+
213
+ - name : Check tests --unstable --features ${{ env.TOKIO_STABLE_FEATURES }}
214
+ run : cargo check --workspace --tests --features $TOKIO_STABLE_FEATURES
209
215
210
216
valgrind :
211
217
name : valgrind
@@ -247,12 +253,11 @@ jobs:
247
253
strategy :
248
254
matrix :
249
255
include :
250
- # We use `--features "full,test-util"` instead of `--all-features` since
251
- # `--all-features` includes `io_uring`, which is not available on all targets.
252
- - { os: windows-latest, features: "full,test-util" }
253
- - { os: ubuntu-latest, features: "full,test-util" }
254
- - { os: ubuntu-latest, features: "full,test-util,io-uring" }
255
- - { os: macos-latest, features: "full,test-util" }
256
+ - { os: windows-latest, extra_features: "" }
257
+ - { os: ubuntu-latest, extra_features: "" }
258
+ # only Linux supports io_uring
259
+ - { os: ubuntu-latest, extra_features: io-uring }
260
+ - { os: macos-latest, extra_features: "" }
256
261
steps :
257
262
- uses : actions/checkout@v5
258
263
- name : Install Rust ${{ env.rust_stable }}
@@ -270,8 +275,8 @@ jobs:
270
275
- name : test tokio full --cfg unstable
271
276
run : |
272
277
set -euxo pipefail
273
- cargo nextest run --features ${{ matrix.features }}
274
- cargo test --doc --features ${{ matrix.features }}
278
+ cargo nextest run --features $TOKIO_STABLE_FEATURES,$ {{ matrix.extra_features }}
279
+ cargo test --doc --features $TOKIO_STABLE_FEATURES,$ {{ matrix.extra_features }}
275
280
working-directory : tokio
276
281
env :
277
282
RUSTFLAGS : --cfg tokio_unstable -Dwarnings
@@ -304,8 +309,11 @@ jobs:
304
309
- name : test tokio full --cfg unstable --cfg taskdump
305
310
run : |
306
311
set -euxo pipefail
307
- cargo nextest run --all-features
308
- cargo test --doc --all-features
312
+ # taskdump is an unstable feature, but it can only be enabled
313
+ # by --cfg tokio_taskdump, not by a feature flag, so we can
314
+ # use $TOKIO_STABLE_FEATURES here.
315
+ cargo nextest run --features $TOKIO_STABLE_FEATURES
316
+ cargo test --doc --features $TOKIO_STABLE_FEATURES
309
317
working-directory : tokio
310
318
env :
311
319
RUSTFLAGS : --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings
@@ -336,8 +344,11 @@ jobs:
336
344
- name : check tokio full --cfg unstable --cfg internal-mt-counters
337
345
run : |
338
346
set -euxo pipefail
339
- cargo nextest run --all-features
340
- cargo test --doc --all-features
347
+ # taskdump is an unstable feature, but it can only be enabled
348
+ # by --cfg tokio_taskdump, not by a feature flag, so we can
349
+ # use $TOKIO_STABLE_FEATURES here.
350
+ cargo nextest run --features $TOKIO_STABLE_FEATURES
351
+ cargo test --doc --features $TOKIO_STABLE_FEATURES
341
352
working-directory : tokio
342
353
env :
343
354
RUSTFLAGS : --cfg tokio_unstable --cfg tokio_internal_mt_counters -Dwarnings
@@ -405,7 +416,7 @@ jobs:
405
416
- uses : Swatinem/rust-cache@v2
406
417
- name : miri-doc-test
407
418
run : |
408
- cargo miri test --doc --all- features --no-fail-fast
419
+ cargo miri test --doc --features $TOKIO_STABLE_FEATURES --no-fail-fast
409
420
working-directory : tokio
410
421
env :
411
422
MIRIFLAGS : -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
@@ -426,7 +437,7 @@ jobs:
426
437
427
438
- uses : Swatinem/rust-cache@v2
428
439
- name : asan
429
- run : cargo test --workspace --all- features --target x86_64-unknown-linux-gnu --tests -- --test-threads 1 --nocapture
440
+ run : cargo test --workspace --features $TOKIO_STABLE_FEATURES --target x86_64-unknown-linux-gnu --tests -- --test-threads 1 --nocapture
430
441
env :
431
442
RUSTFLAGS : -Z sanitizer=address --cfg tokio_no_tuning_tests
432
443
# Ignore `trybuild` errors as they are irrelevant and flaky on nightly
@@ -444,6 +455,9 @@ jobs:
444
455
rust-toolchain : ${{ env.rust_stable }}
445
456
package : tokio
446
457
release-type : minor
458
+ feature-group : only-explicit-features
459
+ # We don't care about the semver of unstable tokio features.
460
+ features : ${{ env.TOKIO_STABLE_FEATURES }}
447
461
- name : Check semver for rest of the workspace
448
462
if : ${{ !startsWith(github.event.pull_request.base.ref, 'tokio-1.') }}
449
463
uses : obi1kenobi/cargo-semver-checks-action@v2
@@ -669,9 +683,9 @@ jobs:
669
683
strategy :
670
684
matrix :
671
685
include :
672
- - { name: "", rustflags: "" }
673
- - { name: "--unstable", rustflags: "--cfg tokio_unstable -Dwarnings" }
674
- - { name: "--unstable --taskdump", rustflags: "--cfg tokio_unstable -Dwarnings --cfg tokio_taskdump" }
686
+ - { name: "", rustflags: "", exclude_features: "io-uring" }
687
+ - { name: "--unstable", rustflags: "--cfg tokio_unstable -Dwarnings", exclude_features: "" }
688
+ - { name: "--unstable --taskdump", rustflags: "--cfg tokio_unstable -Dwarnings --cfg tokio_taskdump", exclude_features: "" }
675
689
steps :
676
690
- uses : actions/checkout@v5
677
691
- name : Install Rust ${{ env.rust_nightly }}
@@ -684,7 +698,7 @@ jobs:
684
698
685
699
- uses : Swatinem/rust-cache@v2
686
700
- name : check --feature-powerset ${{ matrix.name }}
687
- run : cargo hack check --all --feature-powerset --depth 2 --keep-going
701
+ run : cargo hack check --all --feature-powerset --exclude-features "${{ matrix.exclude_features }}" -- depth 2 --keep-going
688
702
env :
689
703
RUSTFLAGS : ${{ matrix.rustflags }}
690
704
@@ -698,17 +712,19 @@ jobs:
698
712
with :
699
713
toolchain : ${{ env.rust_min }}
700
714
- uses : Swatinem/rust-cache@v2
701
- - name : " check --workspace --all-features "
715
+ - name : " cargo check "
702
716
run : |
703
717
if [[ "${{ github.event.pull_request.base.ref }}" =~ ^tokio-1\..* ]]; then
704
718
# Only check `tokio` crate as the PR is backporting to an earlier tokio release.
705
- cargo check -p tokio --all-features
719
+
720
+ cargo check -p tokio --features $TOKIO_STABLE_FEATURES
706
721
else
707
722
# Check all crates in the workspace
708
- cargo check --workspace --all-features
723
+
724
+ cargo check -p tokio --features $TOKIO_STABLE_FEATURES
725
+ # Other crates doesn't have unstable features, so we can use --all-features.
726
+ cargo check -p tokio-macros -p tokio-stream -p tokio-util -p tokio-test --all-features
709
727
fi
710
- env :
711
- RUSTFLAGS : " " # remove -Dwarnings
712
728
713
729
minimal-versions :
714
730
name : minimal-versions
@@ -724,14 +740,17 @@ jobs:
724
740
uses : taiki-e/install-action@cargo-hack
725
741
726
742
- uses : Swatinem/rust-cache@v2
727
- - name : " check --all-features - Z minimal-versions"
743
+ - name : " check -Z minimal-versions"
728
744
run : |
729
745
# Remove dev-dependencies from Cargo.toml to prevent the next `cargo update`
730
746
# from determining minimal versions based on dev-dependencies.
731
747
cargo hack --remove-dev-deps --workspace
732
748
# Update Cargo.lock to minimal version dependencies.
733
749
cargo update -Z minimal-versions
734
- cargo hack check --all-features --ignore-private
750
+ # We use `--features "full,test-util"` instead of `--all-features` since
751
+ # `--all-features` includes `io_uring`, which requires '--cfg tokio_unstable'.
752
+ cargo hack check -p tokio --features full,test-util --ignore-private
753
+ cargo hack check -p tokio-macros -p tokio-stream -p tokio-util -p tokio-test --all-features --ignore-private
735
754
- name : " check --all-features --unstable -Z minimal-versions"
736
755
env :
737
756
RUSTFLAGS : --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings
@@ -766,11 +785,6 @@ jobs:
766
785
clippy :
767
786
name : clippy
768
787
runs-on : ubuntu-latest
769
- strategy :
770
- matrix :
771
- rustflags :
772
- - " "
773
- - " --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings"
774
788
steps :
775
789
- uses : actions/checkout@v5
776
790
- name : Install Rust ${{ env.rust_clippy }}
@@ -780,10 +794,12 @@ jobs:
780
794
components : clippy
781
795
- uses : Swatinem/rust-cache@v2
782
796
# Run clippy
783
- - name : " clippy --all ${{ matrix.rustflags }}"
784
- run : cargo clippy --all --tests --all-features --no-deps
797
+ - name : " clippy --all --features ${{ env.TOKIO_STABLE_FEATURES }}"
798
+ run : cargo clippy --all --tests --no-deps --features $TOKIO_STABLE_FEATURES
799
+ - name : " clippy --all --all-features --unstable"
800
+ run : cargo clippy --all --tests --no-deps --all-features
785
801
env :
786
- RUSTFLAGS : ${{ matrix.rustflags }}
802
+ RUSTFLAGS : --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings
787
803
788
804
docs :
789
805
name : docs
@@ -970,7 +986,7 @@ jobs:
970
986
toolchain : ${{ env.rust_nightly }}
971
987
target : x86_64-unknown-redox
972
988
- name : check tokio on redox
973
- run : cargo check --target x86_64-unknown-redox --all- features
989
+ run : cargo check --target x86_64-unknown-redox --features $TOKIO_STABLE_FEATURES
974
990
working-directory : tokio
975
991
976
992
wasm32-unknown-unknown :
@@ -1087,7 +1103,7 @@ jobs:
1087
1103
with :
1088
1104
tool : cargo-check-external-types@0.1.13
1089
1105
- name : check-external-types
1090
- run : cargo check-external-types --all- features
1106
+ run : cargo check-external-types --features $TOKIO_STABLE_FEATURES
1091
1107
working-directory : tokio
1092
1108
1093
1109
check-fuzzing :
0 commit comments