Skip to content

Commit

Permalink
allow removing db models in a feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad committed Nov 22, 2023
1 parent e1003e8 commit c60424f
Show file tree
Hide file tree
Showing 52 changed files with 4,123 additions and 208 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci-without-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI-WITHOUT_DB

on:
push:
branches:
- master
pull_request:

env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal

jobs:
rustfmt:
name: Check Style
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: ${{ env.TOOLCHAIN_PROFILE }}
toolchain: nightly
override: true
components: rustfmt
- run: cargo fmt --all -- --check
working-directory: ./examples/without-db

clippy:
name: Run Clippy
needs: [rustfmt]
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: ${{ env.TOOLCHAIN_PROFILE }}
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
run: cargo clippy -- -W clippy::nursery -W clippy::pedantic -W rust-2018-idioms -W rust-2021-compatibility
working-directory: ./examples/without-db

test:
name: Run Tests
needs: [rustfmt, clippy]
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: ${{ env.TOOLCHAIN_PROFILE }}
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Run cargo test
run: cargo test
working-directory: ./examples/without-db
1 change: 0 additions & 1 deletion Cargo.lock

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

16 changes: 5 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ authors = ["Dotan Nahum <[email protected]>", "Elad Kaplan <[email protected]>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["auth", "cli"]
default = ["auth", "cli", "with-db"]

auth = ["dep:jsonwebtoken", "dep:bcrypt"]
cli = ["dep:clap"]
testing = ["dep:axum-test"]
with-db = ["dep:sea-orm", "dep:sea-orm-migration"]

[dependencies]

Expand All @@ -29,10 +30,10 @@ sea-orm = { version = "0.12.4", features = [
"sqlx-mysql",
"runtime-tokio-rustls",
"macros",
] }
], optional = true }

tokio = { version = "1.33.0", features = ["full"] }
# the rest
sqlx = "0.7.2"

serde = "1.0.193"
serde_json = "1.0.108"
Expand Down Expand Up @@ -64,14 +65,6 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
# cli/migrations
duct = "0.13.6"

# _meta.rs: schema discovery for truncate
# sea-schema = { version = "*", features = ["runtime-tokio-rustls", "sqlx-all"] }
# sqlx = { version = "0.7.2", default-features = false, features = [
# "mysql",
# "postgres",
# ] }
# url = "*"

config = "0.13.3"
tower-http = { version = "0.4.4", features = ["trace", "catch-panic"] }
tower-request-id = "0.2.1"
Expand All @@ -90,6 +83,7 @@ cargo_metadata = "0.18.1"


[dependencies.sea-orm-migration]
optional = true
version = "0.12.4"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
Expand Down
2 changes: 0 additions & 2 deletions examples/demo/Cargo.lock

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

15 changes: 2 additions & 13 deletions examples/demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ edition = "2021"
[dependencies]

rustyrails = { version = "*", path = "../../" }
migration = { path = "migration" }

serde = "*"
serde_json = "*"
Expand All @@ -17,30 +18,17 @@ async-trait = "0.1.74"
tracing = "0.1.40"
chrono = "*"
validator = { version = "*" }

# TODO(review): check if can use this crate from the framework
sea-orm = { version = "0.12.4", features = [
"sqlx-postgres",
"runtime-tokio-rustls",
"macros",
] }
migration = { path = "migration" }


axum = "*"
include_dir = "*"
uuid = { version = "*", features = ["v4"] }

# cli
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json"] }

# TODO: this is required by test-utils remove once,
# test-utils migrated into "rustyrails::testing"
lazy_static = "*"

# TODO: this is required by test-utils. when we should move thie test-utils into the framework and creating a feature called testing
insta = { version = "*", features = ["redactions", "yaml", "filters"] }

[patch.crates-io]
# see https://github.com/heim-rs/darwin-libproc/pull/9
# rusty-sidekiq needs robotty/simple-process-stats which depends on darwin-libproc, which depends on
Expand All @@ -61,3 +49,4 @@ serial_test = "*"
rstest = "*"
rustyrails = { version = "*", path = "../../", features = ["testing"] }
trycmd = "0.14.19"
insta = { version = "*", features = ["redactions", "yaml", "filters"] }
Loading

0 comments on commit c60424f

Please sign in to comment.