Skip to content

Commit

Permalink
Merge branch 'loco-rs:master' into wait-for-background-workers
Browse files Browse the repository at this point in the history
  • Loading branch information
jacovdbergh authored Oct 22, 2024
2 parents 5cf5a88 + 25d8921 commit 5f2e8aa
Show file tree
Hide file tree
Showing 72 changed files with 824 additions and 302 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci-loco-gen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI/loco-gen

on:
push:
branches:
- master
pull_request:

env:
RUST_TOOLCHAIN: stable
TOOLCHAIN_PROFILE: minimal

defaults:
run:
working-directory: ./loco-gen

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

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
components: rustfmt
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Run Clippy
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms

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

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2

- run: |
cargo install --path ../loco-cli
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ jobs:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all
args: --all-features --workspace --exclude loco-gen
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# local dev
todo.txt
todo.md
examples/demo2
*.sqlite
*.sqlite-wal
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Unreleased

* **BREAKING** Improved migration generator. If you have an existing migration project, add the following comment indicator to the top of the `vec` statement and right below the opening bracked like so:
* `cargo loco doctor` now checks for minimal required SeaORM CLI version
* **BREAKING** Improved migration generator. If you have an existing migration project, add the following comment indicator to the top of the `vec` statement and right below the opening bracked like so in `migration/src/lib.rs`:
```rust
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
vec![
Expand Down
43 changes: 27 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["xtask", "loco-extras"]
members = ["xtask", "loco-extras", "loco-gen"]
exclude = ["starters"]

[workspace.package]
Expand All @@ -9,7 +9,7 @@ license = "Apache-2.0"

[package]
name = "loco-rs"
version = "0.11.0"
version = "0.11.1"
description = "The one-person framework for Rust"
homepage = "https://loco.rs/"
documentation = "https://docs.rs/loco-rs"
Expand All @@ -26,7 +26,7 @@ default = ["auth_jwt", "cli", "with-db", "cache_inmem", "bg_redis", "bg_pg"]
auth_jwt = ["dep:jsonwebtoken"]
cli = ["dep:clap"]
testing = ["dep:axum-test"]
with-db = ["dep:sea-orm", "dep:sea-orm-migration"]
with-db = ["dep:sea-orm", "dep:sea-orm-migration", "loco-gen/with-db"]
channels = ["dep:socketioxide"]
# Storage features
all_storage = ["storage_aws_s3", "storage_azure", "storage_gcp"]
Expand All @@ -39,14 +39,15 @@ bg_redis = ["dep:rusty-sidekiq", "dep:bb8"]
bg_pg = ["dep:sqlx", "dep:ulid"]

[dependencies]
loco-gen = { path = "./loco-gen" }
backtrace_printer = { version = "1.3.0" }

# cli
clap = { version = "4.4.7", features = ["derive"], optional = true }
colored = "2"


sea-orm = { version = "1.0.0", features = [
sea-orm = { version = "1.1.0", features = [
"sqlx-postgres", # `DATABASE_DRIVER` feature
"sqlx-sqlite",
"runtime-tokio-rustls",
Expand All @@ -57,8 +58,8 @@ tokio = { version = "1.33.0", default-features = false }
tokio-util = "0.7.10"
# the rest

serde = "1"
serde_json = "1"
serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml = "0.9"
serde_variant = "0.1.2"

Expand All @@ -67,8 +68,8 @@ async-trait = { workspace = true }

axum = { workspace = true }
axum-extra = { version = "0.9", features = ["cookie"] }
regex = "1"
lazy_static = "1.4.0"
regex = { workspace = true }
lazy_static = { workspace = true }
fs-err = "2.11.0"
# mailer
tera = "1.19.1"
Expand All @@ -80,8 +81,8 @@ lettre = { version = "0.11.4", default-features = false, features = [
"tokio1-rustls-tls",
] }
include_dir = "0.7.3"
thiserror = "1"
tracing = "0.1.40"
thiserror = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tracing-appender = "0.2.3"

Expand All @@ -101,15 +102,11 @@ hyper = "1.1"
mime = "0.3"
bytes = "1.1"
ipnetwork = "0.20.0"
semver = "1"

axum-test = { version = "16.1.0", optional = true }

# gen
rrgen = "0.5.3"
chrono = "0.4.31"
cargo_metadata = "0.18.1"
dialoguer = "0.11.0"

chrono = { workspace = true }
cfg-if = "1"

uuid = { version = "1.10.0", features = ["v4", "fast-rng"] }
Expand Down Expand Up @@ -139,6 +136,14 @@ rusty-sidekiq = { version = "0.11.0", default-features = false, optional = true
bb8 = { version = "0.8.1", optional = true }

[workspace.dependencies]

chrono = { version = "0.4", features = ["serde"] }
tracing = "0.1.40"
regex = "1"
thiserror = "1"
serde = "1"
serde_json = "1"
lazy_static = "1.4.0"
async-trait = { version = "0.1.74" }
axum = { version = "0.7.5", features = ["macros"] }
tower = "0.4"
Expand Down Expand Up @@ -169,10 +174,16 @@ features = [
features = ["testing"]

[dev-dependencies]
cargo_metadata = "0.18.1"
loco-rs = { path = ".", features = ["testing"] }
rstest = "0.21.0"
insta = { version = "1.34.0", features = ["redactions", "yaml", "filters"] }
tree-fs = { version = "0.1.0" }
reqwest = { version = "0.12.7" }
serial_test = "3.1.1"
tower = { workspace = true, features = ["util"] }

# generator tests
tempfile = "3"
duct_sh = { version = "0.13.7" }
syn = { version = "2", features = ["full"] }
58 changes: 15 additions & 43 deletions examples/demo/Cargo.lock

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

2 changes: 1 addition & 1 deletion examples/demo/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async-std = { version = "1", features = ["attributes", "tokio1"] }
loco-rs = { path = "../../../", version = "*" }

[dependencies.sea-orm-migration]
version = "1.0.0"
version = "1.1.0"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
Expand Down
32 changes: 32 additions & 0 deletions loco-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "loco-gen"
version = "0.11.0"
description = "Loco generators"
license.workspace = true
edition.workspace = true
rust-version.workspace = true

[features]
with-db = []

[lib]
path = "src/lib.rs"

[dependencies]

lazy_static = { workspace = true }
rrgen = "0.5.3"
serde = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
regex = { workspace = true }
tracing = { workspace = true }
chrono = { workspace = true }

clap = { version = "4.4.7", features = ["derive"] }
dialoguer = "0.11"
duct = "0.13"

[dev-dependencies]
tempfile = "3"
syn = { version = "2", features = ["full"] }
Loading

0 comments on commit 5f2e8aa

Please sign in to comment.