Skip to content

Commit

Permalink
Travis: Made Travis file tolerant against default job issue
Browse files Browse the repository at this point in the history
Details:

* We define the job matrix explicitly with include statements, so
  that we have granular control over which combinations will run.
  Also, an explicit job matrix is required for OS-X support on the
  public Travis.

  When defining the job matrix explicitly, there are Travis environments
  that produce an additional default job. See these Travis issues:
    travis-ci/travis-ci#1228
    travis-ci/travis-ci#4681
    travis-ci/travis-ci#9843
  The public Travis does not seem to have this issue anymore,
  but Travis@IBM does have this issue (as of 9/2018). The workaround for
  this issue is to define variables globally and to exclude this same
  variable value in the matrix definition. Experiments have shown that
  not all variable combinations work. Using a combination of 'language'
  and 'os' set to the default values works.

* TODO: OS-X is not supported on Travis@IBM, so the inclusion of
  OS-X into the job matrix has been made conditional.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed Sep 3, 2018
1 parent 471733e commit db19b86
Showing 1 changed file with 52 additions and 20 deletions.
72 changes: 52 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,43 @@ notifications:
# and an empty 'python' variable in order to prevent that Travis attempts
# to install Python.
# TODO: Figure out how specific versions of Python 3.x can be used with OS-X

# When defining the job matrix explicitly, there are Travis environments
# that produce an additional default job. See these Travis issues:
# https://github.com/travis-ci/travis-ci/issues/1228
# https://github.com/travis-ci/travis-ci/issues/4681
# https://github.com/travis-ci/travis-ci/issues/9843
# The public Travis does not seem to have this issue anymore,
# but Travis@IBM does have this issue (as of 9/2018). The workaround for
# this issue is to define variables globally and to exclude this same
# variable value in the matrix definition. Experiments have shown that
# not all variable combinations work. Using a combination of 'language'
# and 'os' set to the default values works.

# See note about explicit job matrix, above.
language: ruby
os: linux

matrix:

# See note about explicit job matrix, above.
exclude:
- language: ruby
- os: linux

include:
# - os: linux
# language: python
# python: "2.7"
# env:
# - PACKAGE_LEVEL=minimum
# cache: pip
- os: linux
language: python
python: "2.7"
env:
- PACKAGE_LEVEL=latest
cache: pip
# - os: linux
# language: python
# python: "2.7"
# env:
# - PACKAGE_LEVEL=minimum
# cache: pip
- os: linux
language: python
python: "3.4"
Expand Down Expand Up @@ -75,13 +98,13 @@ matrix:
# env:
# - PACKAGE_LEVEL=latest
# cache: pip
- os: osx
language: generic
python:
env:
- PACKAGE_LEVEL=minimum
- PYTHON=2
cache: pip
# - os: osx
# language: generic
# python:
# env:
# - PACKAGE_LEVEL=minimum
# - PYTHON=2
# cache: pip
# - os: osx
# language: generic
# python:
Expand All @@ -96,15 +119,16 @@ matrix:
# - PACKAGE_LEVEL=minimum
# - PYTHON=3
# cache: pip
- os: osx
language: generic
python:
env:
- PACKAGE_LEVEL=latest
- PYTHON=3
cache: pip
# - os: osx
# language: generic
# python:
# env:
# - PACKAGE_LEVEL=latest
# - PYTHON=3
# cache: pip

before_install:
- env | sort
- if [[ "$TRAVIS_BRANCH" == "manual-ci-run" ]]; then
export _NEED_REBASE=true;
fi
Expand All @@ -115,6 +139,14 @@ before_install:

# commands to install dependencies
install:

# The following statement is a safety net in case the matrix exclusion
# does not work for some reason.
- if [[ "$TRAVIS_LANGUAGE" == "ruby" ]]; then
echo "Exiting from unwanted default Ruby job";
exit;
fi

- if [[ "$TRAVIS_BRANCH" == "manual-ci-run" || "$TRAVIS_PULL_REQUEST_BRANCH" == "manual-ci-run" ]]; then
export _MANUAL_CI_RUN=true;
fi
Expand Down

0 comments on commit db19b86

Please sign in to comment.