From 2e3004f89e77e6f4dd0cc9cb228fb3e5233cd530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 17 Aug 2023 22:29:04 +0200 Subject: [PATCH] CI: Add a test with no-default-features and ensure it passes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- .gitlab-ci.yml | 3 ++- xmpp/Cargo.toml | 4 ++++ xmpp/src/lib.rs | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4b6a3104..e6435c9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,8 @@ variables: .test: stage: test script: - - cargo test --verbose + - cargo test --verbose --release -- --include-ignored + - cargo test --verbose --no-default-features rustfmt: stage: lint diff --git a/xmpp/Cargo.toml b/xmpp/Cargo.toml index a0221516..676fc368 100644 --- a/xmpp/Cargo.toml +++ b/xmpp/Cargo.toml @@ -25,6 +25,10 @@ tokio-util = { version = "0.7", features = ["codec"] } [dev-dependencies] env_logger = "0.10" +[[example]] +name = "hello_bot" +required-features = ["avatar"] + [features] default = ["avatars"] avatars = [] diff --git a/xmpp/src/lib.rs b/xmpp/src/lib.rs index f5528ad4..956d850d 100644 --- a/xmpp/src/lib.rs +++ b/xmpp/src/lib.rs @@ -576,9 +576,11 @@ mod tests { .set_client(ClientType::Bot, "xmpp-rs") .set_website("https://gitlab.com/xmpp-rs/xmpp-rs") .set_default_nick("bot") - .enable_feature(ClientFeature::Avatars) .enable_feature(ClientFeature::ContactList); + #[cfg(feature = "avatars")] + let client_builder = client_builder.enable_feature(ClientFeature::Avatars); + let mut agent: Agent = client_builder.build_impl(client); while let Some(events) = agent.wait_for_events().await {