Skip to content

Commit

Permalink
chore: Added pre-commit and pre-push hooks to ensure proper ci.
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Willems <[email protected]>
  • Loading branch information
jw committed Feb 28, 2024
1 parent 06835af commit add10ac
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .cargo-husky/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

if !(command cargo-make >/dev/null 2>&1); then # Check if cargo-make is installed
echo Attempting to run cargo-make as part of the pre-push hook but it\'s not installed.
echo Please install it by running the following command:
echo
echo " cargo install --force cargo-make"
echo
echo If you don\'t want to run cargo-make as part of the pre-push hook, you can run
echo the following command instead of git push:
echo
echo " git push --no-verify"
exit 1
fi

cargo make ci
16 changes: 16 additions & 0 deletions .cargo-husky/hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

if !(command cargo-make >/dev/null 2>&1); then # Check if cargo-make is installed
echo Attempting to run cargo-make as part of the pre-push hook but it\'s not installed.
echo Please install it by running the following command:
echo
echo " cargo install --force cargo-make"
echo
echo If you don\'t want to run cargo-make as part of the pre-push hook, you can run
echo the following command instead of git push:
echo
echo " git push --no-verify"
exit 1
fi

cargo make ci
1 change: 1 addition & 0 deletions .github/workflows/brt.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: brt

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ battery = "0.7.8"
clap = { version = "4.5.1", features = ["derive"] }
procfs = "0.16.0"
uzers = "0.11.3"

[dev-dependencies.cargo-husky]
version = "1"
default-features = false
features = ["user-hooks"]

0 comments on commit add10ac

Please sign in to comment.