diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7b3cda1..588ea79a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,23 +27,45 @@ jobs: override: true - name: Cargo clippy run: cargo clippy --all --all-targets --all-features -- -D warnings - stable-test: + + test: runs-on: ubuntu-latest + strategy: + matrix: + rust: + - stable + - beta + - nightly + + include: + - rust: stable + features: "--features \"redis-storage cbor-serializer bincode-serializer frunk-\"" + - rust: beta + features: "--features \"redis-storage cbor-serializer bincode-serializer frunk-\"" + - rust: nightly + features: "--all-features" + steps: - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: ${{ matrix.rust }} override: true - - name: Setup redis - run: | - sudo apt install redis-server - redis-server --port 7777 > /dev/null & - redis-server --port 7778 > /dev/null & - redis-server --port 7779 > /dev/null & - - name: Cargo test - run: cargo test --all --all-features + + - name: build + uses: actions-rs/cargo@v1 + with: + command: build + args: --verbose ${{ matrix.features }} + + - name: test + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose ${{ matrix.features }} + build-example: runs-on: ubuntu-latest strategy: diff --git a/Cargo.toml b/Cargo.toml index 37109156..9e85b94f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,3 +68,8 @@ tokio = { version = "0.2.21", features = ["fs", "stream", "rt-threaded", "macros [package.metadata."docs.rs"] all-features = true + +[[test]] +name = "redis" +path = "tests/redis.rs" +required-features = ["redis-storage", "cbor-serializer", "bincode-serializer"] diff --git a/tests/redis.rs b/tests/redis.rs index 3d9da600..0a06c06e 100644 --- a/tests/redis.rs +++ b/tests/redis.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "redis_storage")] - use std::{ fmt::{Debug, Display}, future::Future, @@ -8,7 +6,6 @@ use std::{ use teloxide::dispatching::dialogue::{RedisStorage, Serializer, Storage}; #[tokio::test] -#[cfg(feature = "redis_storage")] async fn test_redis_json() { let storage = RedisStorage::open( "redis://127.0.0.1:7777", @@ -19,7 +16,6 @@ async fn test_redis_json() { test_redis(storage).await; } -#[cfg(feature = "bincode_serializer")] #[tokio::test] async fn test_redis_bincode() { let storage = RedisStorage::open( @@ -31,7 +27,6 @@ async fn test_redis_bincode() { test_redis(storage).await; } -#[cfg(feature = "cbor_serializer")] #[tokio::test] async fn test_redis_cbor() { let storage = RedisStorage::open(