From 5b9d42dea646b77ea269f302c2da05279a3d94e4 Mon Sep 17 00:00:00 2001 From: Awiteb Date: Thu, 1 May 2025 10:08:12 +0000 Subject: [PATCH] chore: Add `justfile` Signed-off-by: Awiteb --- justfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..4af0ff4 --- /dev/null +++ b/justfile @@ -0,0 +1,49 @@ +# This justfile is for the contrbutors of this project, not for the end user. +# +# Requirements for this justfile: +# - Linux distribution +# - just (Of course) +# - cargo (For the build and tests) + +set quiet +set unstable +set shell := ["/usr/bin/env", "bash", "-c"] +set script-interpreter := ["/usr/bin/env", "bash", "-c"] + +JUST_EXECUTABLE := "just -u -f " + justfile() +header := "Available tasks:\n" +# Get the MSRV from the Cargo.toml +msrv := `cat Cargo.toml | grep "rust-version" | sed 's/.*"\(.*\)".*/\1/'` + + +_default: + @{{JUST_EXECUTABLE}} --list-heading "{{header}}" --list + +# Run the CI +ci: && msrv + cargo build -q + cargo fmt -- --check + cargo clippy -- -D warnings + +# Check that the current MSRV is correct +msrv: + rustup toolchain install {{msrv}} + echo "Checking MSRV ({{msrv}})" + cargo +{{msrv}} check -q + echo "MSRV is correct" + +# Update the changelog +[script] +change-log: + OLD_HASH=$(sha256sum CHANGELOG.md | head -c 64) + git-cliff > CHANGELOG.md + NEW_HASH=$(sha256sum CHANGELOG.md | head -c 64) + if [[ $OLD_HASH != $NEW_HASH ]]; then + TZ=UTC git add CHANGELOG.md + TZ=UTC git commit -m 'chore(changelog): Update the changelog' + echo 'The changes have been added to the changelog file and committed' + else + echo 'No changes have been added to the changelog' + fi + +alias cl := change-log