Skip to content

Commit eefc764

Browse files
committed
git-hooks: Add a pre-push sample
even there is already a recipe to add git-hooks, that use 'just' commands.
1 parent 9a33e8f commit eefc764

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

git-hooks/pre-push

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/bash
2+
3+
# Copy this to .git/hooks to use it
4+
# However, there is already a recipe for git-hooks in justfile that
5+
# creates a pre-push with `just test`
6+
7+
# Run pytest
8+
echo "Testing..."
9+
pytest
10+
TEST_EXIT_CODE=$?
11+
12+
if [ $TEST_EXIT_CODE -ne 0 ]; then
13+
echo "Tests failed with exit code $TEST_EXIT_CODE. Cannot proceed with the push."
14+
exit 1
15+
fi
16+
17+
echo "Tests passed. Proceeding with the push."
18+
exit 0

0 commit comments

Comments
 (0)