Add justfile to run CI locally

This commit is contained in:
TheAwiteb 2023-12-31 14:31:10 +03:00
parent 405c7c0810
commit ec93dc0fff
No known key found for this signature in database
GPG key ID: ABF818BD15DC2D34

30
justfile Normal file
View file

@ -0,0 +1,30 @@
# This justfile is for the contrbutors of this project, not for the end user.
#
# Requirements for this justfile:
# - Linux distribution, the real programer does not program on garbage OS like Windows or MacOS
# - just (Of course) <https://github.com/casey/just>
# - cargo (For the build and tests) <https://doc.rust-lang.org/cargo/getting-started/installation.html>
set shell := ["/usr/bin/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 +stable build -q
cargo +stable fmt -- --check
cargo +stable 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"