diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ffbfdd8..6b63f13 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -32,33 +32,39 @@ jobs: - name: Cache Dependencies uses: Swatinem/rust-cache@v2.2.0 - - name: Create test DBs + - name: Install DB CLI tools + run: | + cargo install sqlx-cli --no-default-features --features=rustls,sqlite + cargo install diesel_cli --no-default-features --features sqlite + + - name: Create Test DBs + env: + DATABASE_URL: sqlite://./todo.db run: | sudo apt-get update && sudo apt-get install sqlite3 - cargo install sqlx-cli --no-default-features --features=rustls,sqlite cd basics/todo - DATABASE_URL="sqlite://./todo.db" sqlx database create + sqlx database create chmod a+rwx todo.db - DATABASE_URL="sqlite://./todo.db" sqlx migrate run + sqlx migrate run - name: cargo check - uses: actions-rs/cargo@v1 + run: cargo check --workspace --bins --examples --tests timeout-minutes: 30 - with: - command: check - args: --workspace --bins --examples --tests - - name: start redis + - name: Start Redis uses: supercharge/redis-github-action@1.1.0 with: { redis-version: 6 } - # - name: run diesel migrations - # run: | - # cargo install diesel_cli --no-default-features --features sqlite - # cd databases/diesel - # diesel migration run - # chmod a+rwx test.db - - name: cargo test - run: cargo test --workspace --all-features --no-fail-fast -- --nocapture + run: cargo test --workspace --all-features --no-fail-fast --exclude=diesel-example -- --nocapture timeout-minutes: 30 + + - name: cargo test (diesel) + env: + DATABASE_URL: test.db + run: | + cd databases/diesel + diesel migration run + chmod a+rwx test.db + cargo test -p=diesel-example --all-features --no-fail-fast -- --nocapture + timeout-minutes: 10 diff --git a/Cargo.lock b/Cargo.lock index ad63934..1985cbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5118,7 +5118,8 @@ dependencies = [ [[package]] name = "r2d2_mysql" version = "23.0.0" -source = "git+https://github.com/outersky/r2d2-mysql.git?rev=v23.0.0#5827ac32742f505d60590707e1f79ba735668dca" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9733d738ce65959a744f387bae69aa690a867e18d48e5486b171c47bc7b0c575" dependencies = [ "mysql", "r2d2", diff --git a/Cargo.toml b/Cargo.toml index cdf58bb..42339b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,3 @@ members = [ "websockets/echo", ] resolver = "2" - -[patch.crates-io.r2d2_mysql] -git = "https://github.com/outersky/r2d2-mysql.git" -rev = "v23.0.0" diff --git a/auth/redis-session/Cargo.toml b/auth/redis-session/Cargo.toml index a3518fb..fc88280 100644 --- a/auth/redis-session/Cargo.toml +++ b/auth/redis-session/Cargo.toml @@ -13,5 +13,5 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" [dev-dependencies] -actix-test = "0.1.0-beta.11" -time = "0.3.7" +actix-test = "0.1" +time = "0.3" diff --git a/databases/diesel/src/main.rs b/databases/diesel/src/main.rs index fc621a7..c2078dc 100644 --- a/databases/diesel/src/main.rs +++ b/databases/diesel/src/main.rs @@ -100,8 +100,8 @@ mod tests { env_logger::init(); dotenv::dotenv().ok(); - let connspec = std::env::var("DATABASE_URL").expect("DATABASE_URL"); - let manager = ConnectionManager::::new(connspec); + let conn_spec = std::env::var("DATABASE_URL").expect("DATABASE_URL"); + let manager = ConnectionManager::::new(conn_spec); let pool = r2d2::Pool::builder() .build(manager) .expect("Failed to create pool.");