mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-02 19:55:56 +01:00
chore: update flakebox
This commit is contained in:
12
.config/flakebox/bin/flakebox-in-each-cargo-workspace
Executable file
12
.config/flakebox/bin/flakebox-in-each-cargo-workspace
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run a given command in every directory that contains cargo workspace
|
||||
# Right now it just scans for `Cargo.lock`
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
find . -name Cargo.lock | while read -r path ; do
|
||||
(
|
||||
cd "$(dirname "$path")"
|
||||
"$@"
|
||||
)
|
||||
done
|
||||
@@ -1 +1 @@
|
||||
6ed8d7bac0d49950f28394f623607c29d00896bcf1505d366717626babadd81f8f111f93afd1b991b7087d5ce0684b4bcc10124aad93b3876ba1aba600a09cb4
|
||||
437409787773bc012f713d609c43406e98174dca8d94911ed7905618cc62f2d026781205d6583645176c630878fe6a238e3a17b85254677c632ec4c25b699a4a
|
||||
|
||||
32
justfile
32
justfile
@@ -12,38 +12,70 @@ default:
|
||||
|
||||
# run `cargo build` on everything
|
||||
build:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [ ! -f Cargo.toml ]; then
|
||||
cd {{invocation_directory()}}
|
||||
fi
|
||||
cargo build --workspace --all-targets
|
||||
|
||||
|
||||
# run `cargo check` on everything
|
||||
check:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [ ! -f Cargo.toml ]; then
|
||||
cd {{invocation_directory()}}
|
||||
fi
|
||||
cargo check --workspace --all-targets
|
||||
|
||||
|
||||
# run all checks recommended before opening a PR
|
||||
final-check: lint clippy
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [ ! -f Cargo.toml ]; then
|
||||
cd {{invocation_directory()}}
|
||||
fi
|
||||
cargo test --doc
|
||||
just test
|
||||
|
||||
|
||||
# run code formatters
|
||||
format:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [ ! -f Cargo.toml ]; then
|
||||
cd {{invocation_directory()}}
|
||||
fi
|
||||
cargo fmt --all
|
||||
nixpkgs-fmt $(echo **.nix)
|
||||
|
||||
|
||||
# run lints (git pre-commit hook)
|
||||
lint:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
env NO_STASH=true $(git rev-parse --git-common-dir)/hooks/pre-commit
|
||||
|
||||
|
||||
# run tests
|
||||
test: build
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [ ! -f Cargo.toml ]; then
|
||||
cd {{invocation_directory()}}
|
||||
fi
|
||||
cargo test
|
||||
|
||||
|
||||
# run and restart on changes
|
||||
watch:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [ ! -f Cargo.toml ]; then
|
||||
cd {{invocation_directory()}}
|
||||
fi
|
||||
env RUST_LOG=${RUST_LOG:-debug} cargo watch -x run
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export -f check_nothing
|
||||
function check_cargo_fmt() {
|
||||
set -euo pipefail
|
||||
|
||||
cargo fmt --all --check
|
||||
flakebox-in-each-cargo-workspace cargo fmt --all --check
|
||||
|
||||
}
|
||||
export -f check_cargo_fmt
|
||||
@@ -43,7 +43,7 @@ function check_cargo_lock() {
|
||||
set -euo pipefail
|
||||
|
||||
# https://users.rust-lang.org/t/check-if-the-cargo-lock-is-up-to-date-without-building-anything/91048/5
|
||||
cargo update --workspace --locked
|
||||
flakebox-in-each-cargo-workspace cargo update --workspace --locked
|
||||
|
||||
}
|
||||
export -f check_cargo_lock
|
||||
@@ -52,7 +52,7 @@ function check_leftover_dbg() {
|
||||
set -euo pipefail
|
||||
|
||||
errors=""
|
||||
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep '.*\.rs'); do
|
||||
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep '.*\.rs'); do
|
||||
if grep 'dbg!(' "$path" > /dev/null; then
|
||||
>&2 echo "$path contains dbg! macro"
|
||||
errors="true"
|
||||
|
||||
Reference in New Issue
Block a user