Run tools/lint-all on Travis in python 3.

This commit is contained in:
Eklavya Sharma 2016-07-02 06:36:57 +05:30 committed by Tim Abbott
parent 618410fa1a
commit aa68fd1679
4 changed files with 50 additions and 0 deletions

View File

@ -1,3 +1,4 @@
dist: trusty
before_install:
- nvm install 0.10
install:
@ -29,6 +30,9 @@ matrix:
include:
- python: "3.4"
env: TEST_SUITE=mypy
- python: "3.4"
env: TEST_SUITE=lint-all
sudo: required
# command to run tests
script:
- ./tools/travis/$TEST_SUITE

View File

@ -0,0 +1,11 @@
#!/bin/bash
py_version="$(python -c 'import sys; print(sys.version_info[0])')"
if [ "$py_version" == 2 ]; then
source /srv/zulip-venv/bin/activate
else
source /srv/zulip-py3-venv/bin/activate
fi
echo "Using $VIRTUAL_ENV"

31
tools/travis/lint-all Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
source tools/travis/activate-venv
echo "+ ./tools/lint-all"
./tools/lint-all
retcode="$?"
echo
if [ "$retcode" == 0 ]; then
echo "tools/lint-all detected no errors on Python 3!"
else
echo "tools/lint-all threw some errors in when run using python 3."
echo "This indicates that there is either a bug in your code or your code doesn't"
echo "follow our style guidelines (http://zulip.readthedocs.io/en/latest/code-style.html)."
echo
echo "The most likely problem is that tools/lint-all also fails with Python "
echo "2, which you can check locally by simply running `tools/lint-all` in your "
echo "Zulip development environment."
echo
echo "To run tools/lint-all locally in python 3, you must first install"
echo 'the required packages. To do that, run `python3 provision.py` then'
echo '`source /srv/zulip-py3-venv` and then `tools/lint-all`.'
echo
echo "You can also install tools/lint-all's dependencies manually:"
echo "It requires six, typing (check their versions from requirements/common.txt)."
echo "and pyflakes (check its version from requirements/dev.txt). It is likely that"
echo "you already have a python 3 virtualenv installed in /srv/zulip-py3-venv, but"
echo "you might still need to install the dependencies listed above."
exit 1
fi

4
tools/travis/setup-lint-all Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
set -e
set -x
python tools/provision.py --travis