summaryrefslogtreecommitdiff
path: root/.git-hooks/pre-commit
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2020-06-17 17:39:07 -0400
committerOwen Jacobson <owen@grimoire.ca>2020-06-17 20:05:17 -0400
commit0b669acac07a2b325316a46cca01a5cb85eede3b (patch)
treea190aa4b0ac4c7d56821095f5e42c52969c24f27 /.git-hooks/pre-commit
parent5257b85551459098b8e74cb14e6294a4f1a4226e (diff)
Provide a git hook to automate tests.
When enabled, these hooks run the same tests as Travis, every commit. There's nothing inherently wrong with a failing test run (it's a useful signal), but the turnaround time for responding to Travis is a lot longer than the turnaround time for responding to a local test failure. The tradeoff here is that `git commit`, which is a _very_ common operation, takes considerably longer when the hooks are enabled, and runs a higher risk of giving users doorway effect issues.
Diffstat (limited to '.git-hooks/pre-commit')
-rwxr-xr-x.git-hooks/pre-commit8
1 files changed, 8 insertions, 0 deletions
diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
new file mode 100755
index 0000000..7fd95fb
--- /dev/null
+++ b/.git-hooks/pre-commit
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+# dup of the list in .travis.yml
+cargo build --locked
+cargo test
+cargo fmt -- --check
+cargo clippy -- --deny warnings
+cargo udeps --locked --all-targets