| 1 | #!/bin/sh |
| 2 | set -vex |
| 3 | |
| 4 | if [ "$1" = "py3" ] || [ "$1" = "pep8" ] |
| 5 | then |
| 6 | PYTHON=$(which python3.6) |
| 7 | elif [ "$1" = "env" ] |
| 8 | then |
| 9 | PYTHON=$PYTHON |
| 10 | else |
| 11 | exit 1 |
| 12 | fi |
| 13 | |
| 14 | $PYTHON -V |
| 15 | |
| 16 | # pep8 check |
| 17 | if [ "$2" = "style" ] |
| 18 | then |
| 19 | $PYTHON -m pycodestyle "$(pwd)" \ |
| 20 | --exclude=pep8.py,utils.py \ |
| 21 | --ignore=E402,W503 |
| 22 | touch "$(pwd)/__init__.py" |
| 23 | $PYTHON -m pylint \ |
| 24 | --jobs=0 \ |
| 25 | --disable=C0103,C0111,C0123,C0200,C0325,C0411,C0412,C1801,E0203,E0401 \ |
| 26 | --disable=E0602,E0611,E0711,E1003,E1101,E1102,R0201,R0205,R0801,R0903 \ |
| 27 | --disable=R0912,R0914,R1702,R1705,R1710,R1711,R1714,W0101,W0109 \ |
| 28 | --disable=W0201,W0212,W0221,W0223,W0401 \ |
| 29 | --disable=W0613,W0614 \ |
| 30 | "$(pwd)" |
| 31 | exit 0 |
| 32 | fi |
| 33 | |
| 34 | # tests and coverage for plyer package |
| 35 | $PYTHON -m coverage run \ |
| 36 | --source $APP_DIR/plyer \ |
| 37 | -m unittest discover \ |
| 38 | --start-directory $APP_DIR/plyer/tests \ |
| 39 | --top-level-directory $APP_DIR \ |
| 40 | --failfast |
| 41 | coverage report -m |
| 42 | |
| 43 | # submit coverage report from tests to coveralls.io |
| 44 | # requires: REPO_TOKEN, SERVICE_NAME, JOB_ID, PULL_REQUEST |
| 45 | coveralls || true |
| 46 | |
| 47 | # deploy to PyPI if set in CI with PLYER_DEPLOY variable |
| 48 | if [ "$PLYER_DEPLOY" = "1" ]; then |
| 49 | $PYTHON setup.py sdist bdist_wheel |
| 50 | $PYTHON -m twine upload dist/* |
| 51 | fi |