diff --git a/.github/workflows/cov.yml b/.github/workflows/cov.yml index c08e1cc7c..330695688 100644 --- a/.github/workflows/cov.yml +++ b/.github/workflows/cov.yml @@ -27,16 +27,17 @@ jobs: run: cargo llvm-cov clean --workspace - name: Code coverage (glommio) - run: cargo +nightly llvm-cov --no-report --all --no-default-features --features="glommio,cookie,url,compress,openssl,rustls,ws,brotli" + continue-on-error: true + run: cargo llvm-cov --no-report --all --no-default-features --features="ntex/glommio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" -- --skip test_unhandled_data - - name: Code coverage (compio) - run: cargo +nightly llvm-cov --no-report --all --no-default-features --features="compio,cookie,url,compress,openssl,rustls,ws,brotli" + - name: Code coverage (tokio) + run: cargo llvm-cov --no-report --all --no-default-features --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - - name: Code coverage - run: RUST_LOG=trace cargo +nightly llvm-cov --no-report --all --doctests --no-default-features --features="tokio,cookie,url,compress,openssl,rustls,ws,brotli" + - name: Code coverage (compio) + run: cargo llvm-cov --no-report --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - name: Generate coverage report - run: cargo +nightly llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex="ntex-tokio|ntex-glommio|ntex-async-std|ntex-compio" + run: cargo llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex="ntex-glommio|ntex-async-std" - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f4e239581..863352e02 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -44,22 +44,21 @@ jobs: path: ~/.cargo/git key: ${{ matrix.version }}-x86_64-unknown-linux-gnu-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - - name: Run tests + - name: Run tests (tokio) timeout-minutes: 40 - run: cargo test --all --all-features --no-fail-fast -- --nocapture + run: | + cargo test --all --no-fail-fast --no-default-features --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - - name: Run compio tests + - name: Run tests (compio) timeout-minutes: 40 run: | - cd ntex - cargo test --no-default-features --no-fail-fast --features="compio,cookie,url,compress,openssl,rustls,ws,brotli" + cargo test --all --no-default-features --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - - name: Run async-std tests + - name: Run tests (async-std) timeout-minutes: 40 continue-on-error: true run: | - cd ntex - cargo test --no-default-features --no-fail-fast --features="async-std,cookie,url,compress,openssl,rustls,ws,brotli" + cargo test --all --no-default-features --features="ntex/async-std,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - name: Install cargo-cache continue-on-error: true diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 79751f357..5474c5524 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -37,21 +37,17 @@ jobs: path: ~/.cargo/git key: ${{ matrix.version }}-aarch64-apple-darwin-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - - name: Run tests - run: cargo test --all --all-features --no-fail-fast -- --nocapture + - name: Run tests (tokio) + run: cargo test --all --no-default-features --no-fail-fast --features="ntex/tokio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - - name: Run compio tests + - name: Run tests (compio) timeout-minutes: 40 - run: | - cd ntex - cargo test --no-default-features --no-fail-fast --features="compio,cookie,url,compress,openssl,rustls,ws,brotli" + run: cargo test --all --no-default-features --no-fail-fast --features="ntex/compio,ntex/cookie,ntex/url,ntex/compress,ntex/openssl,ntex/rustls,ntex/ws,ntex/brotli" - name: Install cargo-cache continue-on-error: true - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean + run: cargo install cargo-cache --no-default-features --features ci-autoclean - name: Clear the cargo caches continue-on-error: true - run: | - cargo-cache + run: cargo-cache diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 88348d755..ebda27f0a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -61,11 +61,12 @@ jobs: Get-ChildItem C:\vcpkg\installed\x64-windows\bin Get-ChildItem C:\vcpkg\installed\x64-windows\lib - - name: Run tests + - name: Run tests (tokio) run: | - cargo test --lib --all-features --no-fail-fast -- --nocapture --skip test_timer + cd ntex + cargo test --no-default-features --no-fail-fast --features="tokio,cookie,url,compress,openssl,rustls,ws,brotli" -- --skip test_timer - - name: Run compio tests + - name: Run tests (compio) timeout-minutes: 40 continue-on-error: true run: | diff --git a/ntex-bytes/Cargo.toml b/ntex-bytes/Cargo.toml index a64fc4aa0..1804b2ba2 100644 --- a/ntex-bytes/Cargo.toml +++ b/ntex-bytes/Cargo.toml @@ -29,5 +29,5 @@ simdutf8 = { version = "0.1.4", optional = true } [dev-dependencies] serde_test = "1" serde_json = "1" -ntex = { version = "2", features = ["tokio"] } +ntex = "2" ntex-bytes = { path = ".", features = ["mpool"] } diff --git a/ntex-io/Cargo.toml b/ntex-io/Cargo.toml index be05d6b49..1f47fe291 100644 --- a/ntex-io/Cargo.toml +++ b/ntex-io/Cargo.toml @@ -26,7 +26,6 @@ log = "0.4" pin-project-lite = "0.2" [dev-dependencies] +ntex = "2" rand = "0.8" env_logger = "0.11" - -ntex = { version = "2", features = ["tokio"] } diff --git a/ntex-io/src/dispatcher.rs b/ntex-io/src/dispatcher.rs index dfa56baab..922998138 100644 --- a/ntex-io/src/dispatcher.rs +++ b/ntex-io/src/dispatcher.rs @@ -605,7 +605,6 @@ where #[cfg(test)] mod tests { - use rand::Rng; use std::sync::{atomic::AtomicBool, atomic::Ordering::Relaxed, Arc, Mutex}; use std::{cell::RefCell, io}; @@ -613,6 +612,7 @@ mod tests { use ntex_codec::BytesCodec; use ntex_service::ServiceCtx; use ntex_util::{time::sleep, time::Millis}; + use rand::Rng; use super::*; use crate::{testing::IoTest, Flags, Io, IoRef, IoStream}; @@ -823,6 +823,7 @@ mod tests { assert_eq!(buf, Bytes::from_static(b"GET /test HTTP/1\r\n\r\n")); // write side must be closed, dispatcher waiting for read side to close + sleep(Millis(250)).await; assert!(client.is_closed()); // close read side @@ -875,6 +876,7 @@ mod tests { assert_eq!(buf, Bytes::from_static(b"GET /test HTTP/1\r\n\r\n")); // write side must be closed, dispatcher waiting for read side to close + sleep(Millis(250)).await; assert!(client.is_closed()); // close read side diff --git a/ntex-macros/Cargo.toml b/ntex-macros/Cargo.toml index 40476494e..512b45019 100644 --- a/ntex-macros/Cargo.toml +++ b/ntex-macros/Cargo.toml @@ -16,6 +16,6 @@ syn = { version = "^1", features = ["full", "parsing"] } proc-macro2 = "^1" [dev-dependencies] -ntex = { version = "2", features = ["tokio"] } +ntex = "2" futures = "0.3" -env_logger = "0.11" \ No newline at end of file +env_logger = "0.11" diff --git a/ntex-net/Cargo.toml b/ntex-net/Cargo.toml index 059bd7e4d..33d99009c 100644 --- a/ntex-net/Cargo.toml +++ b/ntex-net/Cargo.toml @@ -47,5 +47,5 @@ log = "0.4" thiserror = "1" [dev-dependencies] +ntex = "2" env_logger = "0.11" -ntex = { version = "2", features = ["tokio"] } diff --git a/ntex-rt/src/lib.rs b/ntex-rt/src/lib.rs index b58a42589..99305b034 100644 --- a/ntex-rt/src/lib.rs +++ b/ntex-rt/src/lib.rs @@ -48,6 +48,7 @@ pub unsafe fn spawn_cbs( }); } +#[allow(dead_code)] #[cfg(feature = "tokio")] mod tokio { use std::future::{poll_fn, Future}; diff --git a/ntex-server/Cargo.toml b/ntex-server/Cargo.toml index 6f7874a5c..8bc3d36bc 100644 --- a/ntex-server/Cargo.toml +++ b/ntex-server/Cargo.toml @@ -30,7 +30,7 @@ socket2 = "0.5" oneshot = { version = "0.1", default-features = false, features = ["async"] } [dev-dependencies] -ntex = { version = "2", features = ["tokio"] } +ntex = "2" ntex-macros = "0.1.3" [target.'cfg(target_family = "unix")'.dependencies] diff --git a/ntex-service/Cargo.toml b/ntex-service/Cargo.toml index fd5f18260..d30a8496a 100644 --- a/ntex-service/Cargo.toml +++ b/ntex-service/Cargo.toml @@ -19,5 +19,5 @@ path = "src/lib.rs" slab = "0.4" [dev-dependencies] -ntex = { version = "2", features = ["tokio"] } +ntex = "2" ntex-util = "2" diff --git a/ntex-tls/Cargo.toml b/ntex-tls/Cargo.toml index 412b02e96..308d2f018 100644 --- a/ntex-tls/Cargo.toml +++ b/ntex-tls/Cargo.toml @@ -40,7 +40,7 @@ tls_openssl = { version = "0.10", package = "openssl", optional = true } tls_rust = { version = "0.23", package = "rustls", optional = true } [dev-dependencies] -ntex = { version = "2", features = ["openssl", "rustls", "tokio"] } +ntex = { version = "2", features = ["openssl", "rustls"] } env_logger = "0.11" rustls-pemfile = "2" webpki-roots = "0.26" diff --git a/ntex/Cargo.toml b/ntex/Cargo.toml index 1416c9d70..de7bb0165 100644 --- a/ntex/Cargo.toml +++ b/ntex/Cargo.toml @@ -18,7 +18,7 @@ edition = "2021" rust-version = "1.75" [package.metadata.docs.rs] -features = ["tokio", "openssl", "rustls", "compress", "cookie", "ws", "brotli"] +features = ["compio", "tokio", "openssl", "rustls", "compress", "cookie", "ws", "brotli"] [lib] name = "ntex"