diff --git a/.helix/config.toml b/.helix/config.toml new file mode 100644 index 0000000..68c2069 --- /dev/null +++ b/.helix/config.toml @@ -0,0 +1,5 @@ +[keys.normal.backspace] +b = ":sh zellij run -x '4%%' --width '92%%' -f -n Build -- just build" +r = ":sh zellij run -x '3%%' -y '8%%' --width '95%%' --height '90%%' -fc -n 'Run' -- just run" +t = ":sh zellij run -x '4%%' --width '92%%' -f -n Tests -- just test" +l = ":sh zellij run -x '4%%' --width '92%%' -f -n Lint -- just lint" diff --git a/Makefile b/Makefile deleted file mode 100644 index 31fce58..0000000 --- a/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -#!make -VERSION := latest -IMG_NAME := darkalex17/managarr -IMAGE := ${IMG_NAME}:${VERSION} - -default: run - -.PHONY: test test-cov build run lint lint-fix fmt analyze sonar release delete-tag - -test: - @cargo test --all - -## Run all tests with coverage - `cargo install cargo-tarpaulin` -test-cov: - @cargo tarpaulin - -build: test - @cargo build --release - -docker: - @DOCKER_BUILDKIT=1 docker build --rm -t ${IMAGE} . - -run: - @CARGO_INCREMENTAL=1 cargo fmt && make lint && cargo run - -lint: - @find . | grep '\.\/src\/.*\.rs$$' | xargs touch && CARGO_INCREMENTAL=0 cargo clippy --all-targets --workspace - -lint-fix: - @cargo fix - -fmt: - @cargo fmt - -minimal-versions: - @cargo +nightly update -Zdirect-minimal-versions - -## Analyze for unsafe usage - `cargo install cargo-geiger` -analyze: - @cargo geiger - -release: - @git tag -a ${V} -m "Release ${V}" && git push origin ${V} - -delete-tag: - @git tag -d ${V} && git push --delete origin ${V} - diff --git a/justfile b/justfile new file mode 100644 index 0000000..b56d3e8 --- /dev/null +++ b/justfile @@ -0,0 +1,81 @@ +VERSION := "latest" +IMG_NAME := "darkalex17/managarr" +IMAGE := "{{IMG_NAME}}:{{VERSION}}" + + +# List all recipes +default: + @just --list + +# Format all files +[group: 'style'] +fmt: + @cargo fmt --all + +alias clippy := lint +# Run Clippy to inspect all files +[group: 'style'] +lint: + @cargo clippy --all + +alias clippy-fix := lint-fix +# Automatically fix clippy issues where possible +[group: 'style'] +lint-fix: + @cargo fix + +# Analyze the project for unsafe usage +[group: 'style'] +analyze: + #!/usr/bin/env bash + @cargo geiger -h > /dev/null 2>&1 | cargo install cargo-geiger + @cargo geiger + +# Run all tests +[group: 'test'] +test: + @cargo test --all + +# Run all tests with coverage +[group:'test'] +test-cov: + #!/usr/bin/env bash + @cargo tarpaulin -h > /dev/null 2>&1 || cargo install cargo-tarpaulin + @cargo tarpaulin + +# Run all doc tests +[group: 'test'] +doctest: + @cargo test --all --doc + +# Run all proptests +[group: 'test'] +proptest: + @cargo test proptest + +# Run all snapshot tests +[group: 'test'] +snapshot-tests: + @cargo test snapshot + +# Review snapshot test changes +[group: 'test'] +snapshot-review: + #!/usr/bin/env bash + @cargo insta -h > /dev/null 2>&1 || cargo install cargo-insta + @cargo insta review + +# Build and run the binary for the current system +run: + @cargo run + +# Build the project for the current system architecture +[group: 'build'] +[arg('build_type', pattern="debug|release")] +build build_type='debug': + @cargo build {{ if build_type == "release" { "--release" } else { "" } }} + +# Build the docker image +[group: 'build'] +build-docker: + @DOCKER_BUILDKIT=1 docker build --rm -t {{IMAGE}}