Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- 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
Expand Down Expand Up @@ -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
Expand All @@ -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/[email protected]
- 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
Expand Down
89 changes: 57 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"]
Expand Down Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion tests/common/features/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ pub async fn create_categories_table(db: &DbConn) -> Result<ExecResult, DbErr> {

#[cfg(feature = "postgres-vector")]
pub async fn create_embedding_table(db: &DbConn) -> Result<ExecResult, DbErr> {
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",
))
Expand Down
Loading