Skip to content

Commit

Permalink
issues-383 Rewrite examples using sea-query-binder
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrivosheev committed Sep 3, 2022
1 parent cb6fd12 commit 6a698de
Show file tree
Hide file tree
Showing 14 changed files with 339 additions and 126 deletions.
251 changes: 234 additions & 17 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,41 @@ env:
CARGO_TERM_COLOR: always

jobs:
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true

- uses: actions-rs/cargo@v1
name: Run rustfmt on `sea-query`
with:
command: fmt
args: >
--all
--
--check
- uses: actions-rs/cargo@v1
name: Run rustfmt on `sea-query-binder`
with:
command: fmt
args: >
--manifest-path sea-query-binder/Cargo.toml
--all
--
--check
clippy:
name: Clippy
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

Expand All @@ -26,17 +58,29 @@ jobs:
toolchain: stable
components: clippy
override: true

- uses: actions-rs/cargo@v1
name: Run clippy on `sea-query`
with:
command: clippy
args: >
--all-targets
--all-features
--workspace
- uses: actions-rs/cargo@v1
name: Run clippy on `sea-query-binder`
with:
command: clippy
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features runtime-async-std-rustls
--features=with-chrono,with-json,with-rust_decimal,with-bigdecimal,with-uuid,with-time,with-ipnetwork,with-mac_address,postgres-array
--
-D warnings
build:
name: Build
name: Build `sea-query`
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
Expand All @@ -46,45 +90,213 @@ jobs:
profile: minimal
toolchain: stable
override: true

- uses: actions-rs/cargo@v1
with:
command: build
args: >
--workspace
--no-default-features
- uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features
args: >
--workspace
--all-features
- uses: actions-rs/cargo@v1
with:
command: build
args: --all-features
args: >
--workspace
--features=with-chrono
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--workspace
--features=with-json
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--workspace
--features=with-rust_decimal
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--workspace
--features=with-bigdecimal
- uses: actions-rs/cargo@v1
with:
command: build
args: --features=thread-safe
args: >
--workspace
--features=with-uuid
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--workspace
--features=with-time
- uses: actions-rs/cargo@v1
with:
command: build
args: --features=with-chrono
args: >
--workspace
--features=with-ipnetwork
- uses: actions-rs/cargo@v1
with:
command: build
args: --features=with-json
args: >
--workspace
--features=with-mac_address
- uses: actions-rs/cargo@v1
with:
command: build
args: --features=with-rust_decimal
args: >
--workspace
--features=postgres-array
- uses: actions-rs/cargo@v1
with:
command: build
args: --features=with-uuid
args: >
--workspace
--features=thread-safe
binder-build:
name: Build `sea-query-binder`
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
runtime: [async-std]
tls: [rustls]
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-chrono,with-json,with-rust_decimal,with-bigdecimal,with-uuid,with-time,with-ipnetwork,with-mac_address,postgres-array
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-chrono
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-json
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-rust_decimal
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-bigdecimal
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-uuid
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-time
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-ipnetwork
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=with-mac_address
- uses: actions-rs/cargo@v1
with:
command: build
args: >
--manifest-path sea-query-binder/Cargo.toml
--workspace
--features sqlx-postgres,sqlx-sqlite,sqlx-any,sqlx-mysql
--features=runtime-${{ matrix.runtime }}-${{ matrix.tls }}
--features=postgres-array
test:
name: Unit Test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: ["build"]
steps:
- uses: actions/checkout@v2

Expand All @@ -101,7 +313,8 @@ jobs:

derive-test:
name: Derive Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: ["build"]
steps:
- uses: actions/checkout@v2

Expand All @@ -125,7 +338,8 @@ jobs:

sqlite:
name: SQLite
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: ["test", "derive-test", "binder-build"]
strategy:
matrix:
example: [rusqlite, sqlx_sqlite]
Expand All @@ -150,7 +364,8 @@ jobs:

mysql:
name: MySQL
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: ["test", "derive-test", "binder-build"]
strategy:
matrix:
version: [8.0, 5.7]
Expand Down Expand Up @@ -192,7 +407,8 @@ jobs:

mariadb:
name: MariaDB
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: ["test", "derive-test", "binder-build"]
strategy:
matrix:
version: [10.6]
Expand Down Expand Up @@ -234,7 +450,8 @@ jobs:

postgres:
name: PostgreSQL
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: ["test", "derive-test", "binder-build"]
strategy:
matrix:
version: [14.4, 13.7, 12.11]
Expand Down
14 changes: 1 addition & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
[workspace]
members = [
".",
"sea-query-derive",
"sea-query-driver",
"sea-query-binder",
"examples/postgres",
"examples/postgres_json",
"examples/rusqlite",
"examples/sqlx_any",
"examples/sqlx_mysql",
"examples/sqlx_postgres",
"examples/sqlx_sqlite",
]
members = [".", "sea-query-derive", "sea-query-driver"]

[package]
name = "sea-query"
Expand Down
4 changes: 3 additions & 1 deletion examples/postgres/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[workspace]

[package]
name = "sea-query-postgres-example"
version = "0.1.0"
Expand All @@ -7,4 +9,4 @@ edition = "2021"
postgres = "^0.19"
sea-query = { path = "../../", features = ["postgres"] }
# NOTE: if you are copying this example into your own project, use the following line instead:
# sea-query = { version = "^0", features = ["postgres"] }
# sea-query = { version = "^0", features = ["postgres"] }
5 changes: 4 additions & 1 deletion examples/postgres_json/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[workspace]
# A separate workspace

[package]
name = "sea-query-postgres-json-example"
version = "0.1.0"
Expand All @@ -19,4 +22,4 @@ sea-query = { path = "../../", features = [
"with-json",
"with-time",
] }
# NOTE: if you are copying this example into your own project, replace `path = ` with `version = "^0"`
# NOTE: if you are copying this example into your own project, replace `path = ` with `version = "^0"`
Loading

0 comments on commit 6a698de

Please sign in to comment.