-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: move gen into a crate - loco-gen + better seperation * implement a generators testing kit similar to Rails' testing rig * separate gen CI from loco CI
- Loading branch information
Showing
56 changed files
with
622 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.