Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot authored Sep 19, 2024
2 parents c07b735 + 883be95 commit d637561
Show file tree
Hide file tree
Showing 570 changed files with 13,299 additions and 87,253 deletions.
64 changes: 62 additions & 2 deletions .github/workflows/ci-generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: cargo install sea-orm-cli

- name: scaffold
run: cargo run -- generate scaffold car name:string year:int && cargo build
run: cargo run -- generate scaffold --htmx car name:string year:int && cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
Expand All @@ -69,7 +69,7 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test

- name: controller
run: cargo run -- generate controller post && cargo build && cargo test requests::post
run: cargo run -- generate controller pages about --htmx && cargo build && cargo test pages
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
Expand All @@ -96,6 +96,13 @@ jobs:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test

- name: scheduler
run: cargo run -- generate scheduler
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test

- name: docker deployment
run: cargo run -- generate deployment
working-directory: ./examples/demo
Expand Down Expand Up @@ -196,6 +203,59 @@ jobs:
json:json! \
json_binary_null:jsonb \
json_binary:jsonb! \
blob_null:blob \
blob:blob! \
money_null:money \
money:money! \
&& cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
DATABASE_URL: ${{matrix.db}}

- name: test ${{ matrix.field_type }} scaffold field type
run: |
cargo run -- generate scaffold --api room \
uuid_uniq:uuid \
uuid_null:uuid_col \
uuid:uuid_col! \
string_null:string \
string:string! \
string_uniq:string^ \
text_null:text \
text:text! \
tiny_integer_null:tiny_int \
tiny_integer:tiny_int! \
tiny_integer_uniq:tiny_int^ \
small_integer_null:small_int \
small_integer:small_int! \
small_integer_uniq:small_int^ \
integer_null:int \
integer:int! \
integer_uniq:int^ \
big_integer_null:big_int \
big_integer:big_int! \
big_integer_uniq:big_int^ \
float_null:float \
float:float! \
double_null:double \
double:double! \
decimal_null:decimal \
decimal:decimal! \
decimal_len_null:decimal_len \
decimal_len:decimal_len! \
boolean_null:bool \
boolean:bool! \
timestamp_with_time_zone_null:tstz \
timestamp_with_time_zone:tstz! \
date_null:date \
date:date! \
timestamp_null:ts \
timestamp:ts! \
json_null:json \
json:json! \
json_binary_null:jsonb \
json_binary:jsonb! \
&& cargo build
working-directory: ./examples/demo
env:
Expand Down
109 changes: 109 additions & 0 deletions .github/workflows/e2e-cli-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: e2e-cli-master

on:
push:
branches:
- master
pull_request:

jobs:
# TODO: re-enable after 0.8 to check cmd spawning fix
saas-template-win32:
name: Create saas (win32)
runs-on: windows-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt
- name: Install seaorm cli
run: cargo install sea-orm-cli
- run: |
cargo install --path .
working-directory: ./loco-cli
- run: |
loco new -n saas -t saas --db sqlite --bg async --assets serverside
env:
ALLOW_IN_GIT_REPO: true
- run: |
cargo build
working-directory: ./saas
- run: |
cargo loco routes
working-directory: ./saas
- run: |
cargo loco db migrate
working-directory: ./saas
- run: |
cargo loco generate scaffold movie title:string
working-directory: ./saas
- run: |
cargo loco db migrate
working-directory: ./saas
saas-template:
name: Create saas
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- run: |
cargo install loco-cli
ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=saas LOCO_TEMPLATE=saas loco new --db postgres --bg queue --assets serverside
- run: |
cargo build
working-directory: ./saas
rest-api:
name: Create rest-api
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- run: |
cargo install loco-cli
ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=restapi LOCO_TEMPLATE=rest-api loco new --db postgres --bg queue
- run: |
cargo build
working-directory: ./restapi
lightweight-service:
name: Create lightweight-service
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
override: true
- run: |
cargo install loco-cli
ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=lightweight LOCO_TEMPLATE=lightweight-service loco new
- run: |
cargo build
working-directory: ./lightweight
7 changes: 3 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
toolchain: nightly
- run: |
cargo install loco-cli
ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=saas LOCO_TEMPLATE=saas loco new
ALLOW_IN_GIT_REPO=true loco new --template saas --name saas --db sqlite --bg async --assets serverside
- run: |
cargo build
working-directory: ./saas
Expand All @@ -40,7 +40,7 @@ jobs:
toolchain: nightly
- run: |
cargo install loco-cli
ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=restapi LOCO_TEMPLATE=rest-api loco new
ALLOW_IN_GIT_REPO=true loco new --template rest-api --name restapi --db sqlite --bg async
- run: |
cargo build
working-directory: ./restapi
Expand All @@ -58,10 +58,9 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
override: true
- run: |
cargo install loco-cli
ALLOW_IN_GIT_REPO=true LOCO_APP_NAME=lightweight LOCO_TEMPLATE=lightweight-service loco new
ALLOW_IN_GIT_REPO=true loco new --template lightweight-service --name lightweight --db sqlite --bg async
- run: |
cargo build
working-directory: ./lightweight
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

## Unreleased

* Add fallback behavior. [https://github.com/loco-rs/loco/pull/732](https://github.com/loco-rs/loco/pull/732)
* Add Scheduler Feature for Running Cron Jobs. [https://github.com/loco-rs/loco/pull/735](https://github.com/loco-rs/loco/pull/735)
* Add `--html`, `--htmx` and `--api` flags to scaffold CLI command. [https://github.com/loco-rs/loco/pull/749](https://github.com/loco-rs/loco/pull/749)
* Add base template for scaffold generation. [https://github.com/loco-rs/loco/pull/752](https://github.com/loco-rs/loco/pull/752)
* Connect Redis only when the worker is BackgroundQueue. [https://github.com/loco-rs/loco/pull/755](https://github.com/loco-rs/loco/pull/755)

## v0.8.1
* fix: introduce secondary binary for compile-and-run on Windows. [https://github.com/loco-rs/loco/pull/727](https://github.com/loco-rs/loco/pull/727)


## v0.8.0

* Added: loco-cli (`loco new`) now receives options from CLI and/or interactively asks for configuration options such as which asset pipeline, background worker type, or database provider to use.
* Fix: custom queue names now merge with default queues.
* Added `remote_ip` middleware for resolving client remote IP when under a proxy or loadbalancer, similar to the Rails `remote_ip` middleware.
* Added `secure_headers` middleware for setting secure headers by default, similar to how [https://github.com/github/secure_headers](https://github.com/github/secure_headers) works. This is now ON by default to promote security-by-default.
* Added: `money`, `blob` types to entitie generator.

## 0.7.0
* Moving to _timezone aware timestamps_. From now on migrations will generate **timestamps with time zone** by default. Moving to TZ aware timestamps in combination with newly revamped timestamp code generation in SeaORM v1.0.0 finally allows for _seamlessly_ moving between using `sqlite` and `postgres` with minimal or no entities code changes (resolved [this long standing issue](https://github.com/loco-rs/loco/issues/518#issuecomment-2051708319)). TZ aware timestamps also aligns us with how Rails works today (initially Rails had a no-tz timestamps, and today the default is to use timestamps). If not specified the TZ is the server TZ, which is usually UTC, therefore semantically this is almost like a no-tz timestamp.

Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Updating the Documentation
+ Create the snippet in the [yaml file](./snipdoc.yml) or inline the code.
+ Run `snipdoc run`.

To run the documentation site locally, we use [zola](https://www.getzola.org/) so you'll need to [install](https://www.getzola.org/documentation/getting-started/installation/) it. The documentation site works with zola version `0.19.2` and since zola still has breaking changes, we make no guarantees about other versions.

Running the local preview
+ `cd docs-site`
+ `npm run serve` or `zola serve`

## Open A Pull Request

Expand Down
49 changes: 27 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "Apache-2.0"

[package]
name = "loco-rs"
version = "0.7.0"
version = "0.8.1"
description = "The one-person framework for Rust"
homepage = "https://loco.rs/"
documentation = "https://docs.rs/loco-rs"
Expand Down Expand Up @@ -72,19 +72,19 @@ fs-err = "2.11.0"
# mailer
tera = "1.19.1"
lettre = { version = "0.11.4", default-features = false, features = [
"builder",
"hostname",
"smtp-transport",
"tokio1-rustls-tls",
"builder",
"hostname",
"smtp-transport",
"tokio1-rustls-tls",
] }
include_dir = "0.7.3"
thiserror = "1"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tracing-appender = "0.2.3"

# cli/migrations
duct = "0.13.6"
duct = { version = "0.13.6" }
duct_sh = { version = "0.13.7" }

tower-http = { workspace = true }
byte-unit = "4.0.19"
Expand All @@ -99,6 +99,7 @@ tower = { workspace = true }
hyper = "1.1"
mime = "0.3"
bytes = "1.1"
ipnetwork = "0.20.0"

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

Expand All @@ -113,7 +114,7 @@ uuid = { version = "1.10.0", features = ["v4", "fast-rng"] }
requestty = "0.5.0"

# A socket.io server implementation
socketioxide = { version = "0.13.1", features = ["state"], optional = true }
socketioxide = { version = "0.14.0", features = ["state"], optional = true }


# File Upload
Expand All @@ -122,31 +123,35 @@ object_store = { version = "0.10.2", default-features = false }
# cache
moka = { version = "0.12.7", features = ["sync"], optional = true }

# Scheduler
tokio-cron-scheduler = { version = "0.11.0", features = ["signal"] }
english-to-cron = {version = "0.1.2"}

[workspace.dependencies]
async-trait = { version = "0.1.74" }
axum = { version = "0.7.5", features = ["macros"] }
tower = "0.4"
tower-http = { version = "0.5.0", features = [
"trace",
"catch-panic",
"timeout",
"add-extension",
"cors",
"fs",
"set-header",
"compression-full",
"trace",
"catch-panic",
"timeout",
"add-extension",
"cors",
"fs",
"set-header",
"compression-full",
] }

[dependencies.sea-orm-migration]
optional = true
version = "1.1.0-rc.1"
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.
# e.g.
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
"sqlx-postgres", # `DATABASE_DRIVER` feature
"sqlx-sqlite",
# 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.
# e.g.
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
"sqlx-postgres", # `DATABASE_DRIVER` feature
"sqlx-sqlite",
]

[package.metadata.docs.rs]
Expand Down
Loading

0 comments on commit d637561

Please sign in to comment.