Ajout des hooks de precommit pour vérifier la doc et les tests avant tout commit (il faut executer scripts/install-hooks.sh)
This commit is contained in:
parent
190a7b9be8
commit
5f72e036a5
2
scripts/build-docs.sh
Normal file
2
scripts/build-docs.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Build html doc
|
||||||
|
pipenv run make html
|
9
scripts/install-hooks.sh
Normal file
9
scripts/install-hooks.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
GIT_DIR="$(git rev-parse --git-dir)"
|
||||||
|
|
||||||
|
echo "Installing hooks..."
|
||||||
|
ln -s ../../scripts/pre-commit.sh $GIT_DIR/hooks/pre-commit
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
|
23
scripts/pre-commit.sh
Normal file
23
scripts/pre-commit.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cdroot() {
|
||||||
|
cd "${0%/*}/.."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "Running pre-commit hook"
|
||||||
|
./scripts/run-tests.sh
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Tests must pass before commit!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
./scripts/build-docs.sh
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Doc must pass before commit!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Done."
|
13
scripts/run-tests.sh
Normal file
13
scripts/run-tests.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# if any command inside script returns error, exit and return that error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
cd "${0%/*}/.."
|
||||||
|
|
||||||
|
|
||||||
|
echo "Running tests"
|
||||||
|
# Run test and ignore warnings
|
||||||
|
pipenv run pytest -p no:warnings
|
||||||
|
|
Loading…
Reference in New Issue
Block a user