Skip to content

feature: Add a pre-push git hook #2715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
# this pre-push hook runs style checks and unit tests in python 3.6, 3.7, and 3.8 using tox.

set -e

TOX_PARALLEL_NO_SPINNER=1,
PY_COLORS=0
start_time=`date +%s`
tox -e flake8,pylint,docstyle,black-check,twine --parallel all
./ci-scripts/displaytime.sh 'flake8,pylint,docstyle,black-check,twine' $start_time
start_time=`date +%s`
tox -e sphinx,doc8 --parallel all
./ci-scripts/displaytime.sh 'sphinx,doc8' $start_time
start_time=`date +%s`
tox -e py36,py37,py38 --parallel all -- tests/unit
./ci-scripts/displaytime.sh 'py36,py37,py38 unit' $start_time
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ You can also run them in parallel:
tox -- -n auto tests/integ


Git Hooks
~~~~~~~~~

to enable all git hooks in the .githooks directory, run these commands in the repository directory:

::

find .git/hooks -type l -exec rm {} \;
find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \;

To enable an individual git hook, simply move it from the .githooks/ directory to the .git/hooks/ directory.

Building Sphinx docs
~~~~~~~~~~~~~~~~~~~~

Expand Down