From ba4ae048a525be9e070e5fef462f9fa7eb5f02af Mon Sep 17 00:00:00 2001 From: fivepiece Date: Tue, 22 Jan 2019 21:17:25 +0200 Subject: [PATCH] conditionally run docker tests on travis Makes travis run docker tests only if at least one of the following is true : * This is a cron job * This is a tag push (e.g. release) * The commit message specifies the string TRAVIS_RUN_DOCKERS (also removed `except:` from `.travis.yml` as it's obsolete now) --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index f5e7b89..055ce1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,9 +41,10 @@ matrix: services: docker env: DOCKER_IMG_JM=fedora27-py3 before_install: - - do_on(){ if [ "$TRAVIS_OS_NAME" = "$1" ]; then shift; $@ ; fi; } - - on_host(){ if [ -z "$DOCKER_IMG_JM" ]; then $@ ; fi; } - - on_docker(){ if [ -n "$DOCKER_IMG_JM" ]; then $@ ; fi; } + - do_on(){ if [ "$TRAVIS_OS_NAME" = "$1" ]; then shift; "$@" ; fi; } + - on_host(){ if [ -z "$DOCKER_IMG_JM" ]; then "$@" ; fi; } + - should_run_dockers(){ if [ "$TRAVIS_EVENT_TYPE" = cron ] || [ -n "$TRAVIS_TAG" ] || echo "${TRAVIS_COMMIT_MESSAGE[@]}" | grep -q "TRAVIS_RUN_DOCKERS"; then return 0; else return 1; fi; } + - on_docker(){ if [ -n "$DOCKER_IMG_JM" ] && should_run_dockers; then "$@" ; fi; } - do_on osx pip install virtualenv cache: directories: @@ -66,6 +67,3 @@ script: after_success: - on_docker echo "Success !" - on_host do_on linux coveralls -branches: - except: - - py3