diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9f391104e7..bfa3f92de0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -114,12 +114,13 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} + key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.toml') }} - uses: mozilla-actions/sccache-action@v0.0.9 - - run: cargo clippy --all -- -D warnings - - run: cargo clippy --all --features runtime-tokio-native-tls,sqlx-all -- -D warnings - - run: cargo clippy --manifest-path sea-orm-cli/Cargo.toml -- -D warnings - - run: cargo clippy --manifest-path sea-orm-migration/Cargo.toml -- -D warnings + - run: cargo clippy --all-targets --features runtime-tokio-native-tls,all-extra-features,all-types-1 -- -D warnings + - run: cargo clippy --all-targets --features runtime-tokio-native-tls,all-extra-features,all-types-2 -- -D warnings + - run: cargo clippy --all-targets --workspace --exclude sea-orm --features runtime-tokio-native-tls,sqlx-all -- -D warnings + - run: cargo clippy --all-targets --manifest-path sea-orm-cli/Cargo.toml -- -D warnings + - run: cargo clippy --all-targets --manifest-path sea-orm-migration/Cargo.toml -- -D warnings rustfmt: name: Rustfmt @@ -185,7 +186,7 @@ jobs: cargo build --no-default-features --features seaography cargo build --features rbac,schema-sync - if: matrix.kind == 'test' - run: cargo test --test '*' --features tests-features,${{ matrix.features }} --no-run + run: cargo test --features tests-features,${{ matrix.features }} --no-run test: name: Unit Test @@ -208,6 +209,27 @@ jobs: - run: cargo test --manifest-path sea-orm-cli/Cargo.toml --no-run - run: cargo test --manifest-path sea-orm-cli/Cargo.toml + test-features: + name: Unit Test with features + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + features: ["all-types-1", "all-types-2"] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: actions/cache@v5 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-test-features-${{ hashFiles('**/Cargo.toml') }} + - uses: mozilla-actions/sccache-action@v0.0.9 + - run: cargo test --features all-extra-features,${{ matrix.features }} --no-run + - run: cargo test --features all-extra-features,${{ matrix.features }} + cli: name: CLI needs: init diff --git a/Cargo.toml b/Cargo.toml index 4f5dd1b59c..35984f3f46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,6 +114,40 @@ default = [ "with-time", "sqlite-use-returning-for-3_35", ] +# Backends +rusqlite = [] +sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"] +sqlx-dep = ["sqlx"] +sqlx-mysql = [ + "sqlx-dep", + "sea-query-sqlx/sqlx-mysql", + "sea-schema/sqlx-mysql", +] +sqlx-postgres = [ + "sqlx-dep", + "sea-query-sqlx/sqlx-postgres", + "postgres-array", + "sea-schema/sqlx-postgres", +] +sqlx-sqlite = [ + "sqlx-dep", + "sea-query-sqlx/sqlx-sqlite", + "sea-schema/sqlx-sqlite", +] +# Runtimes +runtime-async-std = ["sqlx?/runtime-async-std"] +runtime-async-std-native-tls = [ + "sqlx?/runtime-async-std-native-tls", + "runtime-async-std", +] +runtime-async-std-rustls = [ + "sqlx?/runtime-async-std-rustls", + "runtime-async-std", +] +runtime-tokio = ["sqlx?/runtime-tokio"] +runtime-tokio-native-tls = ["sqlx?/runtime-tokio-native-tls", "runtime-tokio"] +runtime-tokio-rustls = ["sqlx?/runtime-tokio-rustls", "runtime-tokio"] + entity-registry = ["inventory", "sea-orm-macros/entity-registry"] json-array = [ "postgres-array", @@ -133,42 +167,11 @@ postgres-vector = [ ] proxy = ["serde_json", "serde/derive"] rbac = ["sea-query/audit", "macros"] -runtime-async-std = ["sqlx?/runtime-async-std"] -runtime-async-std-native-tls = [ - "sqlx?/runtime-async-std-native-tls", - "runtime-async-std", -] -runtime-async-std-rustls = [ - "sqlx?/runtime-async-std-rustls", - "runtime-async-std", -] -runtime-tokio = ["sqlx?/runtime-tokio"] -runtime-tokio-native-tls = ["sqlx?/runtime-tokio-native-tls", "runtime-tokio"] -runtime-tokio-rustls = ["sqlx?/runtime-tokio-rustls", "runtime-tokio"] -rusqlite = [] schema-sync = ["sea-schema"] sea-orm-internal = [] seaography = ["sea-orm-macros/seaography"] sqlite-no-row-value-before-3_15 = [] sqlite-use-returning-for-3_35 = [] -sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"] -sqlx-dep = ["sqlx"] -sqlx-mysql = [ - "sqlx-dep", - "sea-query-sqlx/sqlx-mysql", - "sea-schema/sqlx-mysql", -] -sqlx-postgres = [ - "sqlx-dep", - "sea-query-sqlx/sqlx-postgres", - "postgres-array", - "sea-schema/sqlx-postgres", -] -sqlx-sqlite = [ - "sqlx-dep", - "sea-query-sqlx/sqlx-sqlite", - "sea-schema/sqlx-sqlite", -] sync = [] tests-cfg = ["serde/derive"] tests-features = ["default", "rbac", "schema-sync", "with-bigdecimal"] @@ -206,7 +209,29 @@ with-rust_decimal = [ ] with-time = ["time", "sea-query/with-time", "sea-query-sqlx?/with-time"] with-uuid = ["uuid", "sea-query/with-uuid", "sea-query-sqlx?/with-uuid"] - +# For testing +__all-types = [ + "postgres-array", + "postgres-vector", + "with-ipnetwork", + "with-json", + "with-uuid", +] +all-extra-features = [ + "mock", + "proxy", + "rbac", +] +all-types-1 = [ + "__all-types", + "with-chrono", + "with-rust_decimal", +] +all-types-2 = [ + "__all-types", + "with-bigdecimal", + "with-time", +] # This allows us to develop using a local version of sea-query [patch.crates-io] # sea-query = { path = "../sea-query" } diff --git a/tests/common/features/schema.rs b/tests/common/features/schema.rs index 0a8ad8dde8..fc07bec17f 100644 --- a/tests/common/features/schema.rs +++ b/tests/common/features/schema.rs @@ -676,7 +676,7 @@ pub async fn create_categories_table(db: &DbConn) -> Result { #[cfg(feature = "postgres-vector")] pub async fn create_embedding_table(db: &DbConn) -> Result { - db.execute(sea_orm::Statement::from_string( + db.execute_raw(sea_orm::Statement::from_string( db.get_database_backend(), "CREATE EXTENSION IF NOT EXISTS vector", ))