Skip to content

Improve transaction manager implementation #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Sep 27, 2022
Merged
33 changes: 9 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ jobs:
- name: Install postgres (MacOS)
if: runner.os == 'macOS' && matrix.backend == 'postgres'
run: |
/usr/local/opt/postgres/bin/pg_ctl -D /usr/local/var/postgres start
initdb -D /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres start
sleep 3
/usr/local/opt/postgres/bin/createuser -s postgres
createuser -s postgres
echo "DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV

- name: Install mysql (MacOS)
Expand Down Expand Up @@ -106,33 +107,23 @@ jobs:
echo "DATABASE_URL=mysql://root@localhost/diesel_test" >> $GITHUB_ENV

- name: Install rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Rust version check
uses: actions-rs/cargo@v1
with:
command: version
run: cargo +${{ matrix.rust }} version

- name: Test diesel_async
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }}"
run: cargo +${{ matrix.rust }} test --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }} deadpool bb8 mobc"

rustfmt_and_clippy:
name: Check rustfmt style && run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
components: clippy, rustfmt
override: true
- name: Cache cargo registry
uses: actions/cache@v2
with:
Expand All @@ -148,13 +139,7 @@ jobs:
find ~/.cargo/registry -iname "*clippy.toml" -delete

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all
run: cargo +stable clippy --all

- name: Check formating
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo +stable fmt --all -- --check
107 changes: 100 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "AGPL-v3"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
diesel = { version = "2.0.0-rc.1", default-features = false, features = ["i-implement-a-third-party-backend-and-opt-into-breaking-changes"]}
diesel = { version = "2.0.0", default-features = false, features = ["i-implement-a-third-party-backend-and-opt-into-breaking-changes"]}
async-trait = "0.1.51"
futures = "0.3.17"
tokio-postgres = { version = "0.7.2", optional = true}
Expand All @@ -28,11 +28,17 @@ chrono = "0.4"
diesel = { version = "2.0.0-rc.1", default-features = false, features = ["chrono"]}

[features]
default = ["postgres", "mysql", "deadpool", "bb8", "mobc"]
default = []
mysql = ["diesel/mysql_backend", "mysql_async", "mysql_common"]
postgres = ["diesel/postgres_backend", "tokio-postgres", "tokio", "tokio/rt-multi-thread"]

[[test]]
name = "integration_tests"
path = "tests/lib.rs"
harness = true

[package.metadata.docs.rs]
features = ["postgres", "mysql", "deadpool", "bb8", "mobc"]
no-default-features = true
rustc-args = ["--cfg", "doc_cfg"]
rustdoc-args = ["--cfg", "doc_cfg"]
Loading