From 6b9417db5f2adbdc60e9dd8dc5acbbe2a1f77ba9 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Mon, 15 Jan 2024 13:50:52 -0800 Subject: [PATCH] build: add cargo husky pre-commit hook (#8) --- .cargo-husky/hooks/pre-commit | 15 +++++++++++++++ Cargo.lock | 7 +++++++ Cargo.toml | 4 ++++ 3 files changed, 26 insertions(+) create mode 100755 .cargo-husky/hooks/pre-commit diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit new file mode 100755 index 0000000..cd6c64a --- /dev/null +++ b/.cargo-husky/hooks/pre-commit @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Exit on error. Append "|| true" if you expect an error. +set -o errexit +# Exit on error inside any functions or subshells. +set -o errtrace +# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR +set -o nounset +# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip` +set -o pipefail +# Turn on traces, useful while debugging but commented out by default +# set -o xtrace + +cargo nextest run +cargo test --doc \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 5c0f3f5..c9ebf27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,6 +47,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +[[package]] +name = "cargo-husky" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad" + [[package]] name = "cassowary" version = "0.3.0" @@ -258,6 +264,7 @@ dependencies = [ name = "ratatui-macros" version = "0.2.4" dependencies = [ + "cargo-husky", "ratatui", "trybuild", ] diff --git a/Cargo.toml b/Cargo.toml index accf002..f643ccd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,3 +18,7 @@ ratatui = "0.26.0-alpha.1" [dev-dependencies] trybuild = { version = "1.0.88", features = ["diff"] } +cargo-husky = { version = "1.5.0", features = ["user-hooks"] } + + +