Skip to content

Commit

Permalink
Merge 3ef7409 into 5399940
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-maier committed Nov 4, 2018
2 parents 5399940 + 3ef7409 commit 486bebe
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 54 deletions.
184 changes: 138 additions & 46 deletions .travis.yml
Expand Up @@ -5,83 +5,175 @@
notifications:
email: false

language: python

# For Linux, we let Travis build the job matrix from these dimensions:
sudo: required
python:
- "2.7"
- "3.6"
os:
- linux
env:
- PACKAGE_LEVEL=minimum
- PACKAGE_LEVEL=latest

# For OS-X, we define the job matrix explicitly. These combinations
# are added to the automatically built job matrix for Linux.
# Reason is that Travis has half-baked support for Python that does not work,
# so it needs to be invoked with language=generic and empty python in order to
# prevent that Travis attempts to install Python.
# We define the job matrix explicitly, in order to minimize the
# combinations.
# For OS-X, using an explicit matrix is required, because Travis at
# this point only has half-baked support for Python on OS-X that does
# not work. Also, on OS-X, it needs to be invoked with language=generic
# 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
# TODO: OS-X not supported in IBM Travis CI, Re-enable OS-X when moving to external Travis CI.
#matrix:
# include:
# - os: osx

# 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: "3.5"
env:
- PACKAGE_LEVEL=minimum
cache: pip
# - os: linux
# language: python
# python: "3.5"
# env:
# - PACKAGE_LEVEL=latest
# cache: pip
# - os: linux
# language: python
# python: "3.6"
# env:
# - PACKAGE_LEVEL=minimum
# cache: pip
# - os: linux
# language: python
# python: "3.6"
# env:
# - PACKAGE_LEVEL=latest
# cache: pip
# - os: linux
# dist: xenial
# sudo: required
# language: generic
# python:
# language: python
# python: "3.7"
# env:
# - PACKAGE_LEVEL=minimum
# - PYTHON=2
# cache: pip
- os: linux
dist: xenial
sudo: required
language: python
python: "3.7"
env:
- PACKAGE_LEVEL=latest
cache: pip
# - os: linux
# language: python
# python: "pypy-5.3.1" # Python 2.7.10
# env:
# - PACKAGE_LEVEL=minimum
# cache: pip
# - os: linux
# language: python
# python: "pypy-5.3.1" # Python 2.7.10
# env:
# - PACKAGE_LEVEL=latest
# cache: pip
- os: osx
language: generic
python:
env:
- PACKAGE_LEVEL=minimum
- PYTHON=2
cache: pip
# - os: osx
# sudo: required
# language: generic
# python:
# env:
# - PACKAGE_LEVEL=latest
# - PYTHON=2
# cache: pip
# - os: osx
# sudo: required
# language: generic
# python:
# env:
# - PACKAGE_LEVEL=minimum
# - PYTHON=3
# - os: osx
# sudo: required
# language: generic
# python:
# env:
# - PACKAGE_LEVEL=latest
# - PYTHON=3
# cache: pip
- os: osx
language: generic
python:
env:
- PACKAGE_LEVEL=latest
- PYTHON=3
cache: pip

# Reason for setting up a Python virtualenv on OS-X:
# Some Ansible scripts are invoked directly from the cloned Ansible repo
# directory, so their hashbang is '/usr/bin/env python'. This requires
# that the 'python' command and environment is the desired one. On OS-X,
# when installing Python 3, only the 'python3' command invokes Python 3,
# but the 'python' command invokes Python 2. Therefore, a virtualenv is
# needed in which the desired Python version is available as the
# 'python'. command. Travis does not set up a virtualenv on its OS-X
# machines, so we need to do that here.

# commands to install dependencies
install:
- env | sort
- which python
- python --version
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
if [[ ${PYTHON:0:1} == '2' ]]; then
OSX_PYTHON_PKG=python;
export PYTHON_CMD=python;
export PIP_CMD=pip;
OSX_PYTHON_CMD=python;
else
OSX_PYTHON_PKG=python3;
export PYTHON_CMD=python3;
export PIP_CMD=pip3;
OSX_PYTHON_CMD=python3;
fi;
brew update;
brew ls --versions $OSX_PYTHON_PKG && brew upgrade $OSX_PYTHON_PKG || brew install $OSX_PYTHON_PKG;
else
export PYTHON_CMD=python;
export PIP_CMD=pip;
which $OSX_PYTHON_CMD || brew install $OSX_PYTHON_PKG;
fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
pip install virtualenv;
VENV=$HOME/virtualenv/$OSX_PYTHON_CMD;
virtualenv -p $OSX_PYTHON_CMD $VENV;
source $VENV/bin/activate;
fi
- id
- pwd
- which python
- python --version
- which pip
- pip --version
- pip list --format columns
- git clone https://github.com/andy-maier/ansible.git --branch zhmc-fixes --depth 1 ../ansible
- $PIP_CMD list
- make develop
- make install
- $PIP_CMD install python-coveralls
- $PIP_CMD list
- pip install python-coveralls
- pip list --format columns
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 && $PACKAGE_LEVEL == latest ]]; then make doccheck; fi
# Note: the module doc build generates different order of module suboptions on py2 and py3.

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -187,7 +187,7 @@ help:
@echo ' install - Install package (as editable) and its reqs into active Python environment'
@echo ' develop - Set up the development environment'
@echo ' docs - Build the documentation in: $(doc_build_dir)'
@echo ' check - Run all checks (flake8, validate-modules, doccheck)'
@echo ' check - Run all checks (flake8, validate-modules)'
@echo ' test - Run unit tests (and test coverage) and save results in: $(test_log_file)'
@echo ' Env.var TESTCASES can be used to specify a py.test expression for its -k option'
@echo ' all - Do all of the above'
Expand Down Expand Up @@ -226,7 +226,7 @@ docs: $(doc_build_dir)/html/index.html
@echo '$@ done.'

.PHONY: check
check: $(flake8_log_file) $(validate_modules_log_file) doccheck
check: $(flake8_log_file) $(validate_modules_log_file)
@echo '$@ done.'

.PHONY: test
Expand Down Expand Up @@ -349,7 +349,7 @@ $(flake8_log_file): Makefile $(flake8_rc_file) $(check_py_files)
$(validate_modules_log_file): Makefile $(module_py_files) $(validate_modules)
rm -f $@
bash -c 'PYTHONPATH=$(ansible_repo_lib_dir) $(validate_modules) $(module_py_files) 2>&1 |grep -v -E "$(validate_modules_exclude_pattern)" |tee $@.tmp'
if [[ -n "$$(cat $@.tmp)" ]]; then false; fi
bash -c 'if [[ -n "$$(cat $@.tmp)" ]]; then false; fi'
mv -f $@.tmp $@
@echo 'Done: Ansible validate-modules checker succeeded'

Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Expand Up @@ -15,7 +15,7 @@
# Direct dependencies:

# Unit test (imports into testcases):
pytest>=3.0.5 # MIT
pytest>=3.2.0 # MIT

# Unit test (no imports, invoked via py.test script):
# TODO: Remove the pinning of the pytest-cov version again once issue
Expand Down
8 changes: 4 additions & 4 deletions minimum-constraints.txt
Expand Up @@ -58,7 +58,7 @@ urllib3===1.21.1
# Direct dependencies for development (must be consistent with dev-requirements.txt)

# Unit test (imports into testcases):
pytest===3.0.5
pytest===3.2.0

# Unit test (no imports, invoked via py.test script):
pytest-cov===2.4.0
Expand Down Expand Up @@ -90,15 +90,15 @@ bleach===2.1.0
configparser===3.5.0
coverage===3.7.1
docutils===0.13.1
funcsigs===1.0.2; python_version < '3.3'
funcsigs===1.0.2
imagesize===0.7.1
mccabe===0.5.3
more-itertools===4.0.0
packaging===17.1
pathlib2===2.2.0; python_version < '3.6'
pathlib2===2.2.0
pkginfo===1.4.2
pluggy===0.7.1
py===1.4.29
py===1.4.33
pycodestyle===2.2.0
pyflakes===1.3.0
Pygments===2.1.3
Expand Down

0 comments on commit 486bebe

Please sign in to comment.