|
| 1 | +V=0 |
| 2 | +while getopts 'abf:v' flag; do |
| 3 | + case "${flag}" in |
| 4 | + v) V=1 ;; |
| 5 | + *) print_usage |
| 6 | + exit 1 ;; |
| 7 | + esac |
| 8 | +done |
| 9 | + |
| 10 | +echo '#################### Translate Repo Name For Build Tools filename_prefix ####################' |
| 11 | +NAME=$(basename `git rev-parse --show-toplevel`) |
| 12 | +NAME=${NAME,,} |
| 13 | +NAME=$( echo $NAME | tr '_' '-') |
| 14 | +echo $NAME |
| 15 | +echo -e '\n\n\n' |
| 16 | + |
| 17 | +echo '#################### Set up Python ##################' |
| 18 | +python3 --version |
| 19 | +echo -e '\n\n\n' |
| 20 | + |
| 21 | +echo '################## Install dependencies ##################' |
| 22 | +if [[ $V == 1 ]]; then |
| 23 | + wget -O - https://raw.githubusercontent.com/dherrada/actions-ci-circuitpython-libs/master/install.sh | sed 's/pip/pip3/g' | bash || exit 1 |
| 24 | +else |
| 25 | + echo "Installing required tools" |
| 26 | + wget -O - https://raw.githubusercontent.com/dherrada/actions-ci-circuitpython-libs/master/install.sh | sed 's/pip/pip3/g' | bash > /dev/null |
| 27 | +fi |
| 28 | + |
| 29 | +echo -e '\n\n\n' |
| 30 | + |
| 31 | +echo '################### Pip install pylint, black, & Sphinx ##################' |
| 32 | +if [[ $V == 1 ]]; then |
| 33 | + pip3 install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme || exit 1 |
| 34 | +else |
| 35 | + echo 'Installing pylint, black, & Sphinx' |
| 36 | + pip3 install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme > /dev/null |
| 37 | +fi |
| 38 | +echo -e '\n\n\n' |
| 39 | + |
| 40 | +echo '################## Library version ##################' |
| 41 | +git describe --dirty --always --tags |
| 42 | +echo -e '\n\n\n' |
| 43 | + |
| 44 | +echo '################## Check formatting ##################' |
| 45 | +black --check --target-version=py35 . || exit 1 |
| 46 | +echo -e '\n\n\n' |
| 47 | + |
| 48 | +echo '################## Pylint ##################' |
| 49 | +pylint $( find . -path './adafruit*.py' ) || exit 1 |
| 50 | +([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" )) || exit 1 |
| 51 | +echo -e '\n\n\n' |
| 52 | + |
| 53 | +echo '################## Build assets ##################' |
| 54 | +circuitpython-build-bundles --filename_prefix $NAME --library_location . || exit 1 |
| 55 | +echo -e '\n\n\n' |
| 56 | + |
| 57 | +echo '################## Build Docs ####################' |
| 58 | +cd docs |
| 59 | +sphinx-build -E -W -b html . _build/html |
| 60 | +cd .. |
| 61 | + |
| 62 | +rm -rf build-adafruit-circuitpython-* |
| 63 | +rm -rf build_deps |
0 commit comments