Skip to content

Commit

Permalink
Move integration crates in their own workspaces
Browse files Browse the repository at this point in the history
Everytime you hit ctrl+s in VS code, the whole project in checked, which
normally is a nice thing, and I would not like to disable that in my
configuration.

But in rinja, the diffent integration crates don't work well with one
another and every single one will have compile errors in the automatic
check, because `rinja_derive` won't know what the relevant `rinja_xyz`
crate is. This renders the automatic check useless. Then it takes ages
to compile and recompile all transitively used `proc_macros`.

This PR moves all integration crates in there own, individual
workspaces. `cargo check` will ignore them unless you traverse manually
into their folders. The CI is set up to do just that.
  • Loading branch information
Kijewski committed Jul 12, 2024
1 parent dde9414 commit 8d42733
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 43 deletions.
51 changes: 23 additions & 28 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,12 @@ name: CI

on:
push:
branches: ['main']
branches: ['master']
pull_request:
schedule:
- cron: "32 4 * * 5"

jobs:
Test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, beta]
exclude:
- os: macos-latest
rust: beta
- os: windows-latest
rust: beta
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --all-targets
- run: cargo test

Package:
strategy:
matrix:
Expand All @@ -38,20 +18,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- uses: Swatinem/rust-cache@v2
- run: cd ${{ matrix.package }} && cargo test --all-targets
- run: cd ${{ matrix.package }} && cargo nextest run
- run: cd ${{ matrix.package }} && cargo clippy --all-targets -- -D warnings

Lint:
Rustfmt:
runs-on: ubuntu-latest
steps:
# No need to test `rinja_derive_standalone`. It has same the `src` folder as `rinja_derive`.
# No need to run the checks in parallel. They are fast enough.
# No need for caching. No code is compiled at all.
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets -- -D warnings
components: rustfmt
- run: cd rinja && cargo fmt -- --check
- run: cd rinja_actix && cargo fmt -- --check
- run: cd rinja_axum && cargo fmt -- --check
- run: cd rinja_derive && cargo fmt -- --check
- run: cd rinja_parser && cargo fmt -- --check
- run: cd rinja_rocket && cargo fmt -- --check
- run: cd rinja_warp && cargo fmt -- --check
- run: cd testing && cargo fmt -- --check
- run: cd examples/actix-web-app && cargo fmt -- --check

MSRV:
runs-on: ubuntu-latest
Expand Down
11 changes: 0 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
[workspace]
members = [
"rinja",
"rinja_actix",
"rinja_axum",
"rinja_derive",
"rinja_parser",
"rinja_rocket",
"rinja_warp",
"testing",
]
resolver = "2"

default-members = [
"rinja",
"rinja_derive",
"rinja_parser",
"testing",
]
4 changes: 3 additions & 1 deletion rinja_actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ categories = ["template-engine"]
homepage = "https://github.com/rinja-rs/rinja"
repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
workspace = ".."
readme = "README.md"
edition = "2021"
rust-version = "1.71"
Expand All @@ -29,3 +28,6 @@ humansize = ["rinja/humansize"]
num-traits = ["rinja/num-traits"]
serde_json = ["rinja/serde_json"]
urlencode = ["rinja/urlencode"]

[workspace]
members = ["."]
4 changes: 3 additions & 1 deletion rinja_axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ homepage = "https://github.com/rinja-rs/rinja"
repository = "https://github.com/rinja-rs/rinja"
documentation = "https://docs.rs/rinja"
license = "MIT OR Apache-2.0"
workspace = ".."
readme = "README.md"

[dependencies]
Expand All @@ -31,3 +30,6 @@ humansize = ["rinja/humansize"]
num-traits = ["rinja/num-traits"]
serde_json = ["rinja/serde_json"]
urlencode = ["rinja/urlencode"]

[workspace]
members = ["."]
4 changes: 3 additions & 1 deletion rinja_rocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ categories = ["template-engine"]
homepage = "https://github.com/rinja-rs/rinja"
repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
workspace = ".."
readme = "README.md"
edition = "2021"
rust-version = "1.71"
Expand All @@ -27,3 +26,6 @@ humansize = ["rinja/humansize"]
num-traits = ["rinja/num-traits"]
serde_json = ["rinja/serde_json"]
urlencode = ["rinja/urlencode"]

[workspace]
members = ["."]
4 changes: 3 additions & 1 deletion rinja_warp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ categories = ["template-engine"]
homepage = "https://github.com/rinja-rs/rinja"
repository = "https://github.com/rinja-rs/rinja"
license = "MIT OR Apache-2.0"
workspace = ".."
readme = "README.md"
edition = "2021"
rust-version = "1.71"
Expand All @@ -27,3 +26,6 @@ humansize = ["rinja/humansize"]
num-traits = ["rinja/num-traits"]
serde_json = ["rinja/serde_json"]
urlencode = ["rinja/urlencode"]

[workspace]
members = ["."]

0 comments on commit 8d42733

Please sign in to comment.