Skip to content

Commit d159691

Browse files
committed
ci: Split clippy/tests across feature sets
1 parent ee3748a commit d159691

2 files changed

Lines changed: 85 additions & 38 deletions

File tree

.github/workflows/rust.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,13 @@ jobs:
114114
~/.cargo/registry/index/
115115
~/.cargo/registry/cache/
116116
~/.cargo/git/db/
117-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
117+
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.toml') }}
118118
- uses: mozilla-actions/sccache-action@v0.0.9
119-
- run: cargo clippy --all -- -D warnings
120-
- run: cargo clippy --all --features runtime-tokio-native-tls,sqlx-all -- -D warnings
121-
- run: cargo clippy --manifest-path sea-orm-cli/Cargo.toml -- -D warnings
122-
- run: cargo clippy --manifest-path sea-orm-migration/Cargo.toml -- -D warnings
119+
- run: cargo clippy --all-targets --features runtime-tokio-native-tls,all-extra-features,all-types-1 -- -D warnings
120+
- run: cargo clippy --all-targets --features runtime-tokio-native-tls,all-extra-features,all-types-2 -- -D warnings
121+
- run: cargo clippy --all-targets --workspace --exclude sea-orm --features runtime-tokio-native-tls,sqlx-all -- -D warnings
122+
- run: cargo clippy --all-targets --manifest-path sea-orm-cli/Cargo.toml -- -D warnings
123+
- run: cargo clippy --all-targets --manifest-path sea-orm-migration/Cargo.toml -- -D warnings
123124

124125
rustfmt:
125126
name: Rustfmt
@@ -185,7 +186,7 @@ jobs:
185186
cargo build --no-default-features --features seaography
186187
cargo build --features rbac,schema-sync
187188
- if: matrix.kind == 'test'
188-
run: cargo test --test '*' --features tests-features,${{ matrix.features }} --no-run
189+
run: cargo test --features tests-features,${{ matrix.features }} --no-run
189190

190191
test:
191192
name: Unit Test
@@ -208,6 +209,27 @@ jobs:
208209
- run: cargo test --manifest-path sea-orm-cli/Cargo.toml --no-run
209210
- run: cargo test --manifest-path sea-orm-cli/Cargo.toml
210211

212+
test-features:
213+
name: Unit Test with features
214+
runs-on: ubuntu-latest
215+
strategy:
216+
fail-fast: false
217+
matrix:
218+
features: ["all-types-1", "all-types-2"]
219+
steps:
220+
- uses: actions/checkout@v4
221+
- uses: dtolnay/rust-toolchain@stable
222+
- uses: actions/cache@v5
223+
with:
224+
path: |
225+
~/.cargo/registry/index/
226+
~/.cargo/registry/cache/
227+
~/.cargo/git/db/
228+
key: ${{ runner.os }}-cargo-test-features-${{ hashFiles('**/Cargo.toml') }}
229+
- uses: mozilla-actions/sccache-action@v0.0.9
230+
- run: cargo test --features all-extra-features,${{ matrix.features }} --no-run
231+
- run: cargo test --features all-extra-features,${{ matrix.features }}
232+
211233
cli:
212234
name: CLI
213235
needs: init

Cargo.toml

Lines changed: 57 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,40 @@ default = [
114114
"with-time",
115115
"sqlite-use-returning-for-3_35",
116116
]
117+
# Backends
118+
rusqlite = []
119+
sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"]
120+
sqlx-dep = ["sqlx"]
121+
sqlx-mysql = [
122+
"sqlx-dep",
123+
"sea-query-sqlx/sqlx-mysql",
124+
"sea-schema/sqlx-mysql",
125+
]
126+
sqlx-postgres = [
127+
"sqlx-dep",
128+
"sea-query-sqlx/sqlx-postgres",
129+
"postgres-array",
130+
"sea-schema/sqlx-postgres",
131+
]
132+
sqlx-sqlite = [
133+
"sqlx-dep",
134+
"sea-query-sqlx/sqlx-sqlite",
135+
"sea-schema/sqlx-sqlite",
136+
]
137+
# Runtimes
138+
runtime-async-std = ["sqlx?/runtime-async-std"]
139+
runtime-async-std-native-tls = [
140+
"sqlx?/runtime-async-std-native-tls",
141+
"runtime-async-std",
142+
]
143+
runtime-async-std-rustls = [
144+
"sqlx?/runtime-async-std-rustls",
145+
"runtime-async-std",
146+
]
147+
runtime-tokio = ["sqlx?/runtime-tokio"]
148+
runtime-tokio-native-tls = ["sqlx?/runtime-tokio-native-tls", "runtime-tokio"]
149+
runtime-tokio-rustls = ["sqlx?/runtime-tokio-rustls", "runtime-tokio"]
150+
117151
entity-registry = ["inventory", "sea-orm-macros/entity-registry"]
118152
json-array = [
119153
"postgres-array",
@@ -133,42 +167,11 @@ postgres-vector = [
133167
]
134168
proxy = ["serde_json", "serde/derive"]
135169
rbac = ["sea-query/audit", "macros"]
136-
runtime-async-std = ["sqlx?/runtime-async-std"]
137-
runtime-async-std-native-tls = [
138-
"sqlx?/runtime-async-std-native-tls",
139-
"runtime-async-std",
140-
]
141-
runtime-async-std-rustls = [
142-
"sqlx?/runtime-async-std-rustls",
143-
"runtime-async-std",
144-
]
145-
runtime-tokio = ["sqlx?/runtime-tokio"]
146-
runtime-tokio-native-tls = ["sqlx?/runtime-tokio-native-tls", "runtime-tokio"]
147-
runtime-tokio-rustls = ["sqlx?/runtime-tokio-rustls", "runtime-tokio"]
148-
rusqlite = []
149170
schema-sync = ["sea-schema"]
150171
sea-orm-internal = []
151172
seaography = ["sea-orm-macros/seaography"]
152173
sqlite-no-row-value-before-3_15 = []
153174
sqlite-use-returning-for-3_35 = []
154-
sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"]
155-
sqlx-dep = ["sqlx"]
156-
sqlx-mysql = [
157-
"sqlx-dep",
158-
"sea-query-sqlx/sqlx-mysql",
159-
"sea-schema/sqlx-mysql",
160-
]
161-
sqlx-postgres = [
162-
"sqlx-dep",
163-
"sea-query-sqlx/sqlx-postgres",
164-
"postgres-array",
165-
"sea-schema/sqlx-postgres",
166-
]
167-
sqlx-sqlite = [
168-
"sqlx-dep",
169-
"sea-query-sqlx/sqlx-sqlite",
170-
"sea-schema/sqlx-sqlite",
171-
]
172175
sync = []
173176
tests-cfg = ["serde/derive"]
174177
tests-features = ["default", "rbac", "schema-sync", "with-bigdecimal"]
@@ -206,7 +209,29 @@ with-rust_decimal = [
206209
]
207210
with-time = ["time", "sea-query/with-time", "sea-query-sqlx?/with-time"]
208211
with-uuid = ["uuid", "sea-query/with-uuid", "sea-query-sqlx?/with-uuid"]
209-
212+
# For testing
213+
__all-types = [
214+
"postgres-array",
215+
"postgres-vector",
216+
"with-ipnetwork",
217+
"with-json",
218+
"with-uuid",
219+
]
220+
all-extra-features = [
221+
"mock",
222+
"proxy",
223+
"rbac",
224+
]
225+
all-types-1 = [
226+
"__all-types",
227+
"with-chrono",
228+
"with-rust_decimal",
229+
]
230+
all-types-2 = [
231+
"__all-types",
232+
"with-bigdecimal",
233+
"with-time",
234+
]
210235
# This allows us to develop using a local version of sea-query
211236
[patch.crates-io]
212237
# sea-query = { path = "../sea-query" }

0 commit comments

Comments
 (0)