-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-commit.sh
26 lines (20 loc) · 889 Bytes
/
pre-commit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
set -e
echo "Running setup check"
if [ -d pre-commit-venv ]; then rm -rf pre-commit-venv; fi
python -m venv pre-commit-venv
pre-commit-venv/scripts/python.exe -m pip install --upgrade pip
# if a python package
pre-commit-venv/scripts/pip install .
echo "Running formatting, linting, tests"
pre-commit-venv/scripts/pip install -r requirements.txt -r requirements-dev.txt
pre-commit-venv/scripts/python.exe -m black project-folder tests
pre-commit-venv/scripts/python.exe -m flake8 project-folder tests
pre-commit-venv/scripts/python.exe -m pytest
echo "Removing pre-commit venv"
rm -rf pre-commit-venv
echo "Updating docs"
if ! [ -d docs ]; then mkdir docs; fi
# TODO: does not work using venv directly
echo "pydoc-markdown not working in .sh"
echo "Run -> pydoc-markdown -I project-folder --render-toc > docs/README.md"
pydoc-markdown -I project-folder --render-toc > docs/README.md