From 439c00f32a96816f7a9895dd66a6c5dbb96d412c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 6 Oct 2015 06:44:03 +0200 Subject: [PATCH] Run eslint on Travis. See #773. --- .travis.yml | 3 +++ scripts/dev/ci_install.py | 13 ++++++++++--- scripts/dev/ci_run.py | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 549c51c01..6d1984a4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ env: - TESTENV=pyroma - TESTENV=check-manifest - TESTENV=pylint + - TESTENV=eslint # Not really, but this is here so we can do stuff by hand. language: c @@ -63,3 +64,5 @@ matrix: env: TESTENV=check-manifest - os: osx env: TESTENV=pylint + - os: osx + env: TESTENV=eslint diff --git a/scripts/dev/ci_install.py b/scripts/dev/ci_install.py index 2944b385d..05e3622f8 100644 --- a/scripts/dev/ci_install.py +++ b/scripts/dev/ci_install.py @@ -88,8 +88,9 @@ if 'APPVEYOR' in os.environ: check_setup(r'C:\Python34\python') elif TRAVIS_OS == 'linux': - print("sudo pip install tox") - subprocess.check_call(['sudo', 'pip', 'install', 'tox']) + if TESTENV != 'eslint': + print("sudo pip install tox/npm") + subprocess.check_call(['sudo', 'pip', 'install', 'tox']) print("Installing packages...") pkgs = [] @@ -98,13 +99,19 @@ elif TRAVIS_OS == 'linux': pkgs.append('xvfb') if INSTALL_PYQT: pkgs += ['python3-pyqt5', 'python3-pyqt5.qtwebkit'] + if TESTENV == 'eslint': + pkgs += ['npm', 'nodejs'] if pkgs: print("apt-get update...") apt_get(['update']) print("apt-get install...") apt_get(['install'] + pkgs) - check_setup('python3') + + if TESTENV == 'eslint': + subprocess.check_call(['sudo', 'npm', 'install', '-g', 'eslint']) + else: + check_setup('python3') elif TRAVIS_OS == 'osx': print("brew update...") brew(['update'], silent=True) diff --git a/scripts/dev/ci_run.py b/scripts/dev/ci_run.py index 1bd564900..bbbd075d7 100644 --- a/scripts/dev/ci_run.py +++ b/scripts/dev/ci_run.py @@ -53,7 +53,9 @@ if travis_os == 'linux' and testenv == 'py35': elif travis_os == 'osx' and testenv == 'py34': raise Exception("Can't run py34 on OS X") -if testenv == 'py34' and travis_os == 'linux': +if testenv == 'eslint': + subprocess.check_call(['eslint', 'qutebrowser']) +elif testenv == 'py34' and travis_os == 'linux': subprocess.check_call(['xvfb-run', '-s', '-screen 0 640x480x16', 'tox', '-e', testenv]) else: