-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
272 additions
and
16 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,4 @@ | ||
# Project specific environment variables, if you wish to override them or add | ||
# more variables, create a `.env.local` file next to this one | ||
CARGO_REQUIRE_WEB_SUPPORT = "false" | ||
CARGO_REQUIRE_GIT_LFS = "true" |
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
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,202 @@ | ||
# Documentation: https://github.com/sagiegurari/cargo-make | ||
env_files = [".env"] | ||
|
||
## Project dependencies | ||
|
||
[tasks.install-rls] | ||
description = "Install rustup component rls" | ||
workspace = false | ||
private = true | ||
install_crate = { rustup_component_name = "rls" } | ||
|
||
[tasks.install-clippy] | ||
description = "Install rustup component clippy" | ||
workspace = false | ||
private = true | ||
install_crate = { rustup_component_name = "clippy" } | ||
|
||
[tasks.install-rustfmt] | ||
description = "Install rustup component rustfmt" | ||
workspace = false | ||
private = true | ||
install_crate = { rustup_component_name = "rustfmt" } | ||
|
||
[tasks.install-mdbook] | ||
description = "Install crate mdbook for building the documentation" | ||
workspace = false | ||
private = true | ||
install_crate = "mdbook" | ||
|
||
[tasks.install-trunk] | ||
condition = { env = { "CARGO_REQUIRE_WEB_SUPPORT" = "true" } } | ||
description = "Install crate trunk for WASM support" | ||
workspace = false | ||
private = true | ||
install_crate = "trunk" | ||
|
||
[tasks.install-cargo-expand] | ||
description = "Install crate cargo-expand for expanding and inspecting proc macros" | ||
workspace = false | ||
private = true | ||
install_crate = "cargo-expand" | ||
|
||
[tasks.install-target-wasm] | ||
condition = { env = { "CARGO_REQUIRE_WEB_SUPPORT" = "true" } } | ||
description = "Adds the wasm32 target" | ||
workspace = false | ||
private = true | ||
command = "rustup" | ||
args = ["target", "add", "wasm32-unknown-unknown"] | ||
|
||
[tasks.install-web-support] | ||
condition = { env = { "CARGO_REQUIRE_WEB_SUPPORT" = "true" } } | ||
description = "Installs everything to be able to build for the web" | ||
workspace = false | ||
dependencies = ["install-target-wasm", "install-trunk"] | ||
|
||
[tasks.enable-git-hooks] | ||
description = "Enable git hooks by setting the hooksPath to scripts/hooks" | ||
workspace = false | ||
command = "git" | ||
args = ["config", "core.hooksPath", "scripts/hooks"] | ||
|
||
[tasks.install-git-lfs] | ||
condition = { env = { "CARGO_REQUIRE_GIT_LFS" = "true" } } | ||
description = "Makes sure the git lfs hooks are enabled in the repository" | ||
private = false | ||
workspace = false | ||
command = "git" | ||
dependencies = ["enable-git-hooks"] | ||
args = ["lfs", "install", "--force"] | ||
|
||
## Tasks | ||
|
||
[tasks.book-build] | ||
description = "Builds the book for the workspace" | ||
workspace = false | ||
dependencies = ["install-mdbook"] | ||
command = "mdbook" | ||
args = ["build"] | ||
|
||
[tasks.book-serve] | ||
description = "Serves the book for editing" | ||
workspace = false | ||
dependencies = ["install-mdbook"] | ||
command = "mdbook" | ||
args = ["serve"] | ||
|
||
[tasks.lint-clippy] | ||
description = "Lints the entire workspace" | ||
workspace = false | ||
dependencies = ["install-clippy"] | ||
command = "cargo" | ||
args = [ | ||
"clippy", | ||
"--workspace", | ||
"--all-targets", | ||
"--all-features", | ||
"--", | ||
"-D", | ||
"warnings", | ||
] | ||
|
||
[tasks.lint-format] | ||
description = "Format checks the entire workspace" | ||
workspace = false | ||
dependencies = ["install-rustfmt"] | ||
command = "cargo" | ||
args = ["fmt", "--all", "--", "--check"] | ||
|
||
[tasks.format] | ||
description = "Formats the entire workspace" | ||
workspace = false | ||
dependencies = ["install-rustfmt"] | ||
command = "cargo" | ||
args = ["fmt", "--all", "--", "--emit=files"] | ||
|
||
[tasks.each-format] | ||
description = "Formats each project" | ||
dependencies = ["install-rustfmt"] | ||
command = "cargo" | ||
args = ["fmt", "--", "--emit=files"] | ||
|
||
[tasks.clean] | ||
description = "Cleans the workspace" | ||
workspace = false | ||
command = "cargo" | ||
args = ["clean"] | ||
|
||
[tasks.build] | ||
description = "Builds the entire workspace" | ||
workspace = false | ||
category = "Build" | ||
command = "cargo" | ||
args = ["build", "--workspace", "--all-targets", "--all-features"] | ||
|
||
[tasks.each-build] | ||
description = "Build individual projects" | ||
category = "Build" | ||
command = "cargo" | ||
args = ["build", "--all-targets", "--all-features"] | ||
|
||
[tasks.test] | ||
description = "Tests the entire workspace" | ||
workspace = false | ||
command = "cargo" | ||
args = ["test", "--workspace", "--all-features"] | ||
|
||
[tasks.each-test] | ||
description = "Tests individual projects" | ||
command = "cargo" | ||
args = ["test", "--all-features"] | ||
|
||
## Miscellaneous | ||
|
||
[tasks.print-env] | ||
description = "Print the environment" | ||
workspace = false | ||
command = "env" | ||
|
||
## Scripts | ||
|
||
[tasks.script-link-assets] | ||
description = "Run script link_assets.sh" | ||
workspace = false | ||
script = { file = "scripts/link_assets.sh" } | ||
|
||
## Flows | ||
|
||
[tasks.setup] | ||
description = "Prepares the workspace for development" | ||
workspace = false | ||
dependencies = [ | ||
"install-rls", | ||
"install-git-lfs", | ||
"install-clippy", | ||
"install-rustfmt", | ||
"install-mdbook", | ||
"install-cargo-expand", | ||
"install-web-support", | ||
"script-link-assets", | ||
] | ||
|
||
[tasks.lint] | ||
description = "Run clippy and format checking in parallel" | ||
workspace = false | ||
run_task = { name = ["lint-format", "lint-clippy"], parallel = true } | ||
|
||
[tasks.all] | ||
description = "Run every task" | ||
workspace = false | ||
dependencies = ["setup", "format", "build", "lint", "book-build", "test"] | ||
|
||
## Git hooks | ||
|
||
[tasks.pre-commit] | ||
description = "Definition of the pre-commit git hook." | ||
workspace = false | ||
dependencies = ["lint-format", "lint"] | ||
|
||
[tasks.pre-push] | ||
workspace = false | ||
dependencies = ["test"] |
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 was deleted.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/bin/sh | ||
|
||
cargo fmt --all -- --check | ||
cargo clippy --workspace --all-targets --all-features -- -D warnings | ||
cargo make pre-commit |
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,3 +1,3 @@ | ||
#!/bin/sh | ||
|
||
cargo test --workspace --all-features | ||
cargo make pre-push |
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,28 @@ | ||
#!/bin/sh | ||
|
||
repo_root=$(git rev-parse --show-toplevel 2> /dev/null) | ||
|
||
if [ -z "$repo_root" ]; then | ||
echo "No git repository found." | ||
exit 1 | ||
fi | ||
|
||
create_symlinks() { | ||
target_dir=$1 | ||
if [ -d "$repo_root/$target_dir" ]; then | ||
for dir in "$repo_root/$target_dir"/*/; do | ||
if [ -d "${dir}assets" ]; then | ||
echo "An assets directory already exists at ${dir}. Skipping..." | ||
else | ||
relative_path=$(realpath --relative-to="$dir" "$repo_root/assets") | ||
ln -s "$relative_path" "${dir}assets" | ||
echo "Created symlink for ${dir}assets" | ||
fi | ||
done | ||
else | ||
echo "Directory $target_dir not found." | ||
fi | ||
} | ||
|
||
create_symlinks "examples" | ||
create_symlinks "apps" |
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,3 @@ | ||
#!/bin/sh | ||
|
||
cargo install cargo-make |