From 62db2c724f79d41982a1416909bf254e05ab9200 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 15 Mar 2016 19:23:49 +0100 Subject: [PATCH] Try to run Docker on Travis --- .travis.yml | 8 +++++++- scripts/dev/ci/install.py | 6 +++--- scripts/dev/ci/travis_run.sh | 8 ++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 scripts/dev/ci/travis_run.sh diff --git a/.travis.yml b/.travis.yml index 085b1b4ac..5c3eaf4f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,12 @@ matrix: env: TESTENV=py34-cov - os: linux env: TESTENV=unittests-nodisp + - os: linux + env: DOCKER=debian-jessie + services: docker + - os: linux + env: DOCKER=archlinux + services: docker - os: osx env: TESTENV=py35 - os: linux @@ -38,7 +44,7 @@ install: - python scripts/dev/ci/install.py script: - - tox -e $TESTENV + - bash scripts/dev/ci/travis_run.sh after_success: - '[[ $TESTENV == *-cov ]] && codecov -e TESTENV -X gcov' diff --git a/scripts/dev/ci/install.py b/scripts/dev/ci/install.py index e56752cfa..09a740e3a 100644 --- a/scripts/dev/ci/install.py +++ b/scripts/dev/ci/install.py @@ -40,13 +40,13 @@ try: except ImportError: winreg = None -TESTENV = os.environ['TESTENV'] +TESTENV = os.environ.get('TESTENV', None) TRAVIS_OS = os.environ.get('TRAVIS_OS_NAME', None) INSTALL_PYQT = TESTENV in ('py34', 'py35', 'py34-cov', 'py35-cov', 'unittests-nodisp', 'vulture', 'pylint') XVFB = TRAVIS_OS == 'linux' and TESTENV == 'py34' pip_packages = ['tox'] -if TESTENV.endswith('-cov'): +if TESTENV is not None and TESTENV.endswith('-cov'): pip_packages.append('codecov') @@ -115,7 +115,7 @@ if 'APPVEYOR' in os.environ: f.write(r'@C:\Python34\python %*') check_setup(r'C:\Python34\python') -elif TRAVIS_OS == 'linux': +elif TRAVIS_OS == 'linux' and 'DOCKER' not in os.environ: folded_cmd(['sudo', 'pip', 'install'] + pip_packages) pkgs = [] diff --git a/scripts/dev/ci/travis_run.sh b/scripts/dev/ci/travis_run.sh new file mode 100644 index 000000000..ddedb0099 --- /dev/null +++ b/scripts/dev/ci/travis_run.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ $DOCKER ]]; then + docker build -t img misc/docker/$DOCKER + docker run --privileged -v $PWD:/outside img +else + tox -e $TESTENV +fi