Skip to content

Commit

Permalink
change sqlx version to 0.6.3 and using Pool instead of Transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
pxp9 committed Apr 9, 2024
1 parent 0a23009 commit cc792ab
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 249 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,60 @@ jobs:

- name: Build release
run: cargo build --release --verbose --all-features --target x86_64-unknown-linux-gnu

test_mysql:
name: Test mysql
runs-on: ubuntu-latest
env:
DATABASE_URL: mysql://root:mysql@localhost/fang
CARGO_TERM_COLOR: always

services:
mysql:
image: mysql:8.1
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: fang
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --connect-timeout 5s --wait=5

strategy:
matrix:
toolchain:
- stable

steps:
- uses: actions/checkout@v3

- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

- name: Install diesel-cli
run: cargo install diesel_cli --no-default-features --features mysql

- name: Setup Sqlite db
working-directory: ./fang/mysql_migrations
run: diesel setup --database-url "mysql://root:mysql@localhost/fang"

- name: Run tests
run: cargo test "asynk::async_queue::mysql" --verbose --features asynk-mysql -- --nocapture

release:
name: Release x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always

strategy:
matrix:
toolchain:
- stable

steps:
- uses: actions/checkout@v3
- name: Setup Rust
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}

- name: Build release
run: cargo build --release --verbose --all-features --target x86_64-unknown-linux-gnu
8 changes: 5 additions & 3 deletions fang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ migrations = ["dep:diesel_migrations"]
[dev-dependencies]
fang-derive-error = { version = "0.1.0"}
diesel_migrations = { version = "2.1" , features = ["postgres", "sqlite" , "mysql"]}
sqlx = {git = "https://github.com/pxp9/sqlx", branch = "main", features = ["any" , "macros" , "runtime-tokio", "postgres", "sqlite", "mysql"]}
# console-subscriber = "0.2.0"
sqlx = {version = "0.6.3", features = ["any" , "macros" , "runtime-tokio-rustls", "postgres", "sqlite", "mysql"]}
#sqlx = {git = "https://github.com/pxp9/sqlx", branch = "main", features = ["any" , "macros" , "runtime-tokio", "postgres", "sqlite", "mysql"]}
#console-subscriber = "0.2.0"

[dependencies]
cron = "0.12"
Expand All @@ -55,7 +56,8 @@ fang-derive-error = { version = "0.1.0" , optional = true}
# sqlx with no TLS, if you want TLS you must to get feature "tls-native-tls" or "tls-rustls"
#sqlx = {version = "0.7", features = ["any" , "macros" , "json" , "uuid" , "chrono" , "runtime-tokio", "postgres", "sqlite", "mysql"] }
# https://github.com/launchbadge/sqlx/issues/2416 is fixed in pxp9's fork
sqlx = {git = "https://github.com/pxp9/sqlx", branch = "main", features = ["any" , "macros" , "runtime-tokio"] , optional = true}
#sqlx = {git = "https://github.com/pxp9/sqlx", branch = "main", features = ["any" , "macros" , "runtime-tokio"] , optional = true}
sqlx = {version = "0.6.3", features = ["any" , "macros" , "runtime-tokio-rustls", "postgres", "sqlite", "mysql"], optional = true}

[dependencies.diesel]
version = "2.1"
Expand Down
Loading

0 comments on commit cc792ab

Please sign in to comment.