Speedup CI (#5691)

- Pass `--no-deps` to `cargo-clippy`
 - Use `dtolnay/rust-toolchain@stale` instead of
   `dtolnay/rust-toolchain@master`
 - Use dtolnay/rust-toolchain instead of `rustup` directly
 - Use `cargo-nextest` in job test to speedup testing
 - Use `cargo-nextest` in job test-unstable to speedup testing
 - Use `cargo-nextest` in job test-unstable-taskdump to speedup testing
 - Use `cargo-nextest` in job no-atomic-u64 to speedup testing
 - Use `cargo-nextest` in job check-unstable-mt-counters
 - Run `cargo check --benches` for `benches/` in job test
   Since the benchmark is not run
 - Run `cargo-check` instead of `cargo-build` in job test-parking_lot
   since no test is run
 - Run `cargo-check` instead of `cargo-build` in job no-atomic-u64
 - Run `Swatinem/rust-cache@v2` after `taiki-e/install-action@v2` to
   avoid caching pre-built artifacts downloaded by it.
 - Use `Swatinem/rust-cache@v2` in job no-atomic-u64
 - Add concurrenty group to cancel outdated CI
 - Use `taiki-e/setup-cross-toolchain-action@v1` in job cross-test

   instead of cross, so that we can use `cargo-nextest` to run tests in
   parallel.

   Also use `Swatinem/rust-cache@v2` to cache artifacts.
 - Use `Swatinem/rust-cache@v2` in job cross-check to speedup ci.
 - Fix job `cross-test`: Use `armv5te-unknown-linux-gnueabi` for no-atomic-u64

   testing instead of `arm-unknown-linux-gnueabihf`, which actually has
   atomic-u64
 - Rm use of `cross` in job `cross-check`

   Since it does not run any test, it does not need the `cross-rs`
   toolchain as tokio does not use any external C/C++ library that require
   `gcc`/`clang` to compile.
 - Add more recognizable name for steps in job cross-test
 - Split job `test` into `test-{tokio-full, workspace-all-features,
   integration-tests-per-feature}`
 - Split job `no-atomic-u64` into `no-atomic-u64-{test, check}`
 - Parallelize job `features` by using matrix
 - Split `cross-test` into `cross-test-{with, without}-parking_lot`
 - Speedup job `cross-test-*` and `no-atomic-u64-test` by running
   `cargo-test` with `-- --test-threads 1` since `qemu` userspace
   emulation has problems running binaries with many threads.
 - Speedup workflow `stress-test.yml` and job `valgrind` in workflow `ci.yml`
   by passing `--fair-sched=yes` to `valgrind`.
 - Speedup job `test-hyper`: Cache `./hyper/target`
   instead of caching `./target`, which is non-existent.
 - Set `RUST_TEST_THREADS=1` to make sure `libtest` only use one thread
   so that qemu will be happy with the tests.
   This is applied to `cross-test-with(out)-parking_lot, no-atomic-u64-test`.
 - Apply suggestions from code review

Signed-off-by: Jiahao XU <[email protected]>
This commit is contained in:
Jiahao XU
2023-07-02 16:56:38 +09:00
committed by GitHub
parent bb4512eae0
commit fc69666f8a
2 changed files with 295 additions and 107 deletions
+293 -105
View File
@@ -6,6 +6,10 @@ on:
name: CI name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env: env:
RUSTFLAGS: -Dwarnings RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
@@ -36,15 +40,19 @@ jobs:
name: all systems go name: all systems go
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- test - test-tokio-full
- test-workspace-all-features
- test-integration-tests-per-feature
- test-parking_lot - test-parking_lot
- valgrind - valgrind
- test-unstable - test-unstable
- miri - miri
- asan - asan
- cross-check - cross-check
- cross-test - cross-test-with-parking_lot
- no-atomic-u64 - cross-test-without-parking_lot
- no-atomic-u64-test
- no-atomic-u64-check
- features - features
- minrust - minrust
- minimal-versions - minimal-versions
@@ -76,7 +84,7 @@ jobs:
steps: steps:
- run: exit 0 - run: exit 0
test: test-tokio-full:
needs: basics needs: basics
name: test tokio full name: test tokio full
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -89,24 +97,77 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- name: Install Rust - name: Install cargo-nextest
run: rustup update stable uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: 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.
- name: test tokio full - name: test tokio full
run: cargo test --features full run: |
set -euxo pipefail
cargo nextest run --features full
cargo test --doc --features full
working-directory: tokio working-directory: tokio
test-workspace-all-features:
needs: basics
name: test all crates in the workspace with all features
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2
# Test **all** crates in the workspace with all features. # Test **all** crates in the workspace with all features.
- name: test all --all-features - name: test all --all-features
run: cargo test --workspace --all-features run: |
set -euxo pipefail
cargo nextest run --workspace --all-features
cargo test --doc --workspace --all-features
test-integration-tests-per-feature:
needs: basics
name: Run integration tests for each feature
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- uses: Swatinem/rust-cache@v2
# Run integration tests for each feature # Run integration tests for each feature
- name: test tests-integration --each-feature - name: test tests-integration --each-feature
@@ -118,9 +179,9 @@ jobs:
run: cargo hack test --each-feature run: cargo hack test --each-feature
working-directory: tests-build working-directory: tests-build
# Build benchmarks. Run of benchmarks is done by bench.yml workflow. # Check benchmarks. Run of benchmarks is done by bench.yml workflow.
- name: build benches - name: Check benches
run: cargo build --benches run: cargo check --benches
working-directory: benches working-directory: benches
# bench.yml workflow runs benchmarks only on linux. # bench.yml workflow runs benchmarks only on linux.
if: startsWith(matrix.os, 'ubuntu') if: startsWith(matrix.os, 'ubuntu')
@@ -139,15 +200,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- name: Enable parking_lot send_guard feature - name: Enable parking_lot send_guard feature
# Inserts the line "plsend = ["parking_lot/send_guard"]" right after [features] # Inserts the line "plsend = ["parking_lot/send_guard"]" right after [features]
run: sed -i '/\[features\]/a plsend = ["parking_lot/send_guard"]' tokio/Cargo.toml run: sed -i '/\[features\]/a plsend = ["parking_lot/send_guard"]' tokio/Cargo.toml
- name: Compile tests with all features enabled
run: cargo build --workspace --all-features --tests - uses: Swatinem/rust-cache@v2
- name: Check tests with all features enabled
run: cargo check --workspace --all-features --tests
valgrind: valgrind:
name: valgrind name: valgrind
@@ -156,14 +219,14 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- name: Install Valgrind - name: Install Valgrind
uses: taiki-e/install-action@valgrind uses: taiki-e/install-action@valgrind
- uses: Swatinem/rust-cache@v2
# Compile tests # Compile tests
- name: cargo build test-mem - name: cargo build test-mem
run: cargo build --features rt-net --bin test-mem run: cargo build --features rt-net --bin test-mem
@@ -171,7 +234,7 @@ jobs:
# Run with valgrind # Run with valgrind
- name: Run valgrind test-mem - name: Run valgrind test-mem
run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./target/debug/test-mem run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all --fair-sched=yes ./target/debug/test-mem
# Compile tests # Compile tests
- name: cargo build test-process-signal - name: cargo build test-process-signal
@@ -180,7 +243,7 @@ jobs:
# Run with valgrind # Run with valgrind
- name: Run valgrind test-process-signal - name: Run valgrind test-process-signal
run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./target/debug/test-process-signal run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all --fair-sched=yes ./target/debug/test-process-signal
test-unstable: test-unstable:
name: test tokio full --unstable name: test tokio full --unstable
@@ -195,13 +258,22 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
# Run `tokio` with "unstable" cfg flag. # Run `tokio` with "unstable" cfg flag.
- name: test tokio full --cfg unstable - name: test tokio full --cfg unstable
run: cargo test --all-features run: |
set -euxo pipefail
cargo nextest run --all-features
cargo test --doc --all-features
working-directory: tokio working-directory: tokio
env: env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
@@ -220,13 +292,22 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
# Run `tokio` with "unstable" and "taskdump" cfg flags. # Run `tokio` with "unstable" and "taskdump" cfg flags.
- name: test tokio full --cfg unstable --cfg taskdump - name: test tokio full --cfg unstable --cfg taskdump
run: cargo test --all-features run: |
set -euxo pipefail
cargo nextest run --all-features
cargo test --doc --all-features
working-directory: tokio working-directory: tokio
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings
@@ -245,13 +326,20 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
# Run `tokio` with "unstable" and "taskdump" cfg flags. # Run `tokio` with "unstable" and "taskdump" cfg flags.
- name: check tokio full --cfg unstable --cfg internal-mt-counters - name: check tokio full --cfg unstable --cfg internal-mt-counters
run: cargo test --all-features run: |
set -euxo pipefail
cargo nextest run --all-features
cargo test --doc --all-features
working-directory: tokio working-directory: tokio
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_internal_mt_counters -Dwarnings RUSTFLAGS: --cfg tokio_unstable --cfg tokio_internal_mt_counters -Dwarnings
@@ -266,7 +354,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
components: miri components: miri
@@ -274,7 +362,8 @@ jobs:
- name: miri - name: miri
# Many of tests in tokio/tests and doctests use #[tokio::test] or # Many of tests in tokio/tests and doctests use #[tokio::test] or
# #[tokio::main] that calls epoll_create1 that Miri does not support. # #[tokio::main] that calls epoll_create1 that Miri does not support.
run: cargo miri test --features full --lib --no-fail-fast run: |
cargo miri test --features full --lib --no-fail-fast
working-directory: tokio working-directory: tokio
env: env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
@@ -289,9 +378,10 @@ jobs:
# Required to resolve symbols in sanitizer output # Required to resolve symbols in sanitizer output
run: sudo apt-get install -y llvm run: sudo apt-get install -y llvm
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: asan - name: asan
run: cargo test --workspace --all-features --target x86_64-unknown-linux-gnu --tests -- --test-threads 1 --nocapture run: cargo test --workspace --all-features --target x86_64-unknown-linux-gnu --tests -- --test-threads 1 --nocapture
@@ -327,18 +417,17 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
target: ${{ matrix.target }} target: ${{ matrix.target }}
- name: Install cross
uses: taiki-e/install-action@cross - uses: Swatinem/rust-cache@v2
- run: cross check --workspace --all-features --target ${{ matrix.target }} - run: cargo check --workspace --all-features --target ${{ matrix.target }}
env: env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings RUSTFLAGS: --cfg tokio_unstable -Dwarnings
cross-test: cross-test-with-parking_lot:
name: cross-test
needs: basics needs: basics
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@@ -346,91 +435,175 @@ jobs:
include: include:
- target: i686-unknown-linux-gnu - target: i686-unknown-linux-gnu
rustflags: --cfg tokio_taskdump rustflags: --cfg tokio_taskdump
- target: arm-unknown-linux-gnueabihf - target: armv5te-unknown-linux-gnueabi
- target: armv7-unknown-linux-gnueabihf - target: armv7-unknown-linux-gnueabihf
- target: aarch64-unknown-linux-gnu - target: aarch64-unknown-linux-gnu
rustflags: --cfg tokio_taskdump rustflags: --cfg tokio_taskdump
# Run a platform without AtomicU64 and no const Mutex::new # Run a platform without AtomicU64 and no const Mutex::new
- target: arm-unknown-linux-gnueabihf - target: armv5te-unknown-linux-gnueabi
rustflags: --cfg tokio_no_const_mutex_new rustflags: --cfg tokio_no_const_mutex_new
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust stable - name: Install Rust stable
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
target: ${{ matrix.target }} target: ${{ matrix.target }}
- name: Install cross
uses: taiki-e/install-action@cross - name: Install cargo-nextest
# First run with all features (including parking_lot) uses: taiki-e/install-action@v2
- run: cross test -p tokio --all-features --target ${{ matrix.target }} --tests with:
tool: cargo-nextest
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Tests run with all features (including parking_lot)
run: |
set -euxo pipefail
cargo nextest run -p tokio --all-features --target ${{ matrix.target }}
cargo test --doc -p tokio --all-features --target ${{ matrix.target }} -- --test-threads 1
env: env:
RUST_TEST_THREADS: 1
RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_tuning_tests ${{ matrix.rustflags }} RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_tuning_tests ${{ matrix.rustflags }}
# Now run without parking_lot
cross-test-without-parking_lot:
needs: basics
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: i686-unknown-linux-gnu
rustflags: --cfg tokio_taskdump
- target: armv5te-unknown-linux-gnueabi
- target: armv7-unknown-linux-gnueabihf
- target: aarch64-unknown-linux-gnu
rustflags: --cfg tokio_taskdump
# Run a platform without AtomicU64 and no const Mutex::new
- target: armv5te-unknown-linux-gnueabi
rustflags: --cfg tokio_no_const_mutex_new
steps:
- uses: actions/checkout@v3
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
target: ${{ matrix.target }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Remove `parking_lot` from `full` feature - name: Remove `parking_lot` from `full` feature
run: sed -i '0,/parking_lot/{/parking_lot/d;}' tokio/Cargo.toml run: sed -i '0,/parking_lot/{/parking_lot/d;}' tokio/Cargo.toml
- uses: Swatinem/rust-cache@v2
# The `tokio_no_parking_lot` cfg is here to ensure the `sed` above does not silently break. # The `tokio_no_parking_lot` cfg is here to ensure the `sed` above does not silently break.
- run: cross test -p tokio --features full,test-util --target ${{ matrix.target }} --tests - name: Tests run with all features (without parking_lot)
run: |
set -euxo pipefail
cargo nextest run -p tokio --features full,test-util --target ${{ matrix.target }}
cargo test --doc -p tokio --features full,test-util --target ${{ matrix.target }} -- --test-threads 1
env: env:
RUST_TEST_THREADS: 1
RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_parking_lot --cfg tokio_no_tuning_tests ${{ matrix.rustflags }} RUSTFLAGS: --cfg tokio_unstable -Dwarnings --cfg tokio_no_ipv6 --cfg tokio_no_parking_lot --cfg tokio_no_tuning_tests ${{ matrix.rustflags }}
# See https://github.com/tokio-rs/tokio/issues/5187 # See https://github.com/tokio-rs/tokio/issues/5187
no-atomic-u64: no-atomic-u64-test:
name: Test i686-unknown-linux-gnu without AtomicU64 name: Test tokio --all-features on i686-unknown-linux-gnu without AtomicU64
needs: basics needs: basics
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_nightly }}
components: rust-src
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: i686-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- name: test tokio --all-features
run: |
cargo nextest run -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --all-features
cargo test --doc -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --all-features -- --test-threads 1
env:
RUST_TEST_THREADS: 1
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64 --cfg tokio_no_tuning_tests
no-atomic-u64-check:
name: Check tokio --feature-powerset --depth 2 on i686-unknown-linux-gnu without AtomicU64
needs: basics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
components: rust-src components: rust-src
- name: Install cargo-hack - name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack uses: taiki-e/install-action@v2
# Install linker and libraries for i686-unknown-linux-gnu
- uses: taiki-e/setup-cross-toolchain-action@v1
with: with:
target: i686-unknown-linux-gnu tool: cargo-hack
- run: cargo test -Zbuild-std --target target-specs/i686-unknown-linux-gnu.json -p tokio --all-features -- --test-threads 1 --nocapture
env: - uses: Swatinem/rust-cache@v2
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64 --cfg tokio_no_tuning_tests
# https://github.com/tokio-rs/tokio/pull/5356 # https://github.com/tokio-rs/tokio/pull/5356
# https://github.com/tokio-rs/tokio/issues/5373 # https://github.com/tokio-rs/tokio/issues/5373
- run: cargo hack build -p tokio --feature-powerset --depth 2 --keep-going - name: Check without const_mutex_new
run: cargo hack check -p tokio --feature-powerset --depth 2 --keep-going
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64 --cfg tokio_no_const_mutex_new RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64 --cfg tokio_no_const_mutex_new
- run: cargo hack build -p tokio --feature-powerset --depth 2 --keep-going - name: Check with const_mutex_new
run: cargo hack check -p tokio --feature-powerset --depth 2 --keep-going
env: env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64 RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings --cfg tokio_no_atomic_u64
features: features:
name: features name: features ${{ matrix.name }}
needs: basics needs: basics
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
include:
- { name: "", rustflags: "" }
# Try with unstable feature flags
- { name: "--unstable", rustflags: "--cfg tokio_unstable -Dwarnings" }
# Try with unstable and taskdump feature flags
- { name: "--unstable --taskdump", rustflags: "--cfg tokio_unstable -Dwarnings --cfg tokio_taskdump" }
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
target: ${{ matrix.target }} target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install cargo-hack - name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack uses: taiki-e/install-action@cargo-hack
- name: check --feature-powerset
run: cargo hack check --all --feature-powerset --depth 2 --keep-going - uses: Swatinem/rust-cache@v2
# Try with unstable feature flags - name: check --feature-powerset ${{ matrix.name }}
- name: check --feature-powerset --unstable
run: cargo hack check --all --feature-powerset --depth 2 --keep-going run: cargo hack check --all --feature-powerset --depth 2 --keep-going
env: env:
RUSTFLAGS: --cfg tokio_unstable -Dwarnings RUSTFLAGS: ${{ matrix.rustflags }}
# Try with unstable and taskdump feature flags
- name: check --feature-powerset --unstable --taskdump
run: cargo hack check --all --feature-powerset --depth 2 --keep-going
env:
RUSTFLAGS: --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings
minrust: minrust:
name: minrust name: minrust
@@ -438,7 +611,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_min }} - name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_min }} toolchain: ${{ env.rust_min }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
@@ -454,12 +627,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
- uses: Swatinem/rust-cache@v2
- name: Install cargo-hack - name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
- 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`
@@ -485,7 +659,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
components: rustfmt components: rustfmt
@@ -505,14 +679,14 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_clippy }} - name: Install Rust ${{ env.rust_clippy }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_clippy }} toolchain: ${{ env.rust_clippy }}
components: clippy components: clippy
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
# Run clippy # Run clippy
- name: "clippy --all" - name: "clippy --all"
run: cargo clippy --all --tests --all-features run: cargo clippy --all --tests --all-features --no-deps
docs: docs:
name: docs name: docs
@@ -520,12 +694,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
- name: "doc --lib --all-features" - name: "doc --lib --all-features"
run: cargo doc --lib --no-deps --all-features --document-private-items run: |
cargo doc --lib --no-deps --all-features --document-private-items
env: env:
RUSTFLAGS: --cfg docsrs --cfg tokio_unstable --cfg tokio_taskdump RUSTFLAGS: --cfg docsrs --cfg tokio_unstable --cfg tokio_taskdump
RUSTDOCFLAGS: --cfg docsrs --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings RUSTDOCFLAGS: --cfg docsrs --cfg tokio_unstable --cfg tokio_taskdump -Dwarnings
@@ -537,7 +712,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
@@ -572,18 +747,23 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- name: Test hyper - name: Clone hyper
run: git clone https://github.com/hyperium/hyper.git
- name: Checkout the latest release because HEAD maybe contains breakage.
run: | run: |
set -x set -x
git clone https://github.com/hyperium/hyper.git
cd hyper
# checkout the latest release because HEAD maybe contains breakage.
tag=$(git describe --abbrev=0 --tags) tag=$(git describe --abbrev=0 --tags)
git checkout "${tag}" git checkout "${tag}"
working-directory: hyper
- name: Patch hyper to use tokio from this repository
run: |
set -x
echo '[workspace]' >>Cargo.toml echo '[workspace]' >>Cargo.toml
echo '[patch.crates-io]' >>Cargo.toml echo '[patch.crates-io]' >>Cargo.toml
echo 'tokio = { path = "../tokio" }' >>Cargo.toml echo 'tokio = { path = "../tokio" }' >>Cargo.toml
@@ -591,7 +771,20 @@ jobs:
echo 'tokio-stream = { path = "../tokio-stream" }' >>Cargo.toml echo 'tokio-stream = { path = "../tokio-stream" }' >>Cargo.toml
echo 'tokio-test = { path = "../tokio-test" }' >>Cargo.toml echo 'tokio-test = { path = "../tokio-test" }' >>Cargo.toml
git diff git diff
cargo test --features full working-directory: hyper
- uses: Swatinem/rust-cache@v2
with:
# The cargo workspaces and target directory configuration.
# These entries are separated by newlines and have the form
# `$workspace -> $target`. The `$target` part is treated as a directory
# relative to the `$workspace` and defaults to "target" if not explicitly given.
# default: ". -> target"
workspaces: "./hyper"
- name: Test hyper
run: cargo test --features full
working-directory: hyper
x86_64-fortanix-unknown-sgx: x86_64-fortanix-unknown-sgx:
name: build tokio for x86_64-fortanix-unknown-sgx name: build tokio for x86_64-fortanix-unknown-sgx
@@ -600,7 +793,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
target: x86_64-fortanix-unknown-sgx target: x86_64-fortanix-unknown-sgx
@@ -632,12 +825,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- name: Install wasm-pack - name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: Swatinem/rust-cache@v2
- name: test tokio - name: test tokio
run: wasm-pack test --node -- --features "macros sync" run: wasm-pack test --node -- --features "macros sync"
working-directory: tokio working-directory: tokio
@@ -649,24 +843,18 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }} - name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2 targets: wasm32-wasi
# Install dependencies # Install dependencies
- name: Install cargo-hack - name: Install cargo-hack, wasmtime, and cargo-wasi
uses: taiki-e/install-action@cargo-hack uses: taiki-e/install-action@v2
with:
- name: Install wasm32-wasi target tool: cargo-hack,wasmtime,cargo-wasi
run: rustup target add wasm32-wasi
- name: Install wasmtime
uses: taiki-e/install-action@wasmtime
- name: Install cargo-wasi
run: cargo install cargo-wasi
- uses: Swatinem/rust-cache@v2
- name: WASI test tokio full - name: WASI test tokio full
run: cargo test -p tokio --target wasm32-wasi --features full run: cargo test -p tokio --target wasm32-wasi --features full
env: env:
@@ -706,7 +894,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust }} - name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
@@ -725,7 +913,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }} - name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: ${{ env.rust_nightly }} toolchain: ${{ env.rust_nightly }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
+2 -2
View File
@@ -28,14 +28,14 @@ jobs:
uses: dtolnay/rust-toolchain@master uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{ env.rust_stable }} toolchain: ${{ env.rust_stable }}
- uses: Swatinem/rust-cache@v2
- name: Install Valgrind - name: Install Valgrind
uses: taiki-e/install-action@valgrind uses: taiki-e/install-action@valgrind
- uses: Swatinem/rust-cache@v2
# Compiles each of the stress test examples. # Compiles each of the stress test examples.
- name: Compile stress test examples - name: Compile stress test examples
run: cargo build -p stress-test --release --example ${{ matrix.stress-test }} run: cargo build -p stress-test --release --example ${{ matrix.stress-test }}
# Runs each of the examples using Valgrind. Detects leaks and displays them. # Runs each of the examples using Valgrind. Detects leaks and displays them.
- name: Run valgrind - name: Run valgrind
run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./target/release/examples/${{ matrix.stress-test }} run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all --fair-sched=yes ./target/release/examples/${{ matrix.stress-test }}