Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes in Travis and Makefile #80

Merged
merged 2 commits into from Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 53 additions & 14 deletions .travis.yml
Expand Up @@ -133,21 +133,39 @@ matrix:
- 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.
before_install:
- env | sort

# The following statement is a workaround to leave an OS-X job
# when running on Linux. That happens on Travis@IBM which does not
# have OS-X support but still runs os=osx on Linux.
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$_system_type" == "Linux" ]]; then
echo "Exiting from OS-X job running on Linux";
exit;
fi

# 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" ]]; then
export _NEED_REBASE=true;
fi
- if [[ -n $_NEED_REBASE ]]; then git fetch origin master; fi
- if [[ -n $_NEED_REBASE ]]; then git branch master FETCH_HEAD; fi
- if [[ -n $_NEED_REBASE ]]; then git rebase master; fi
- git branch -av

# commands to install dependencies
install:
- env | sort
- which python
- python --version
- if [[ "$TRAVIS_BRANCH" == "manual-ci-run" || "$TRAVIS_PULL_REQUEST_BRANCH" == "manual-ci-run" ]]; then
export _MANUAL_CI_RUN=true;
fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
if [[ ${PYTHON:0:1} == '2' ]]; then
OSX_PYTHON_PKG=python;
Expand All @@ -158,24 +176,43 @@ install:
fi;
which $OSX_PYTHON_CMD || brew install $OSX_PYTHON_PKG;
fi

# 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.
- 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

- which python
- python --version
- which pip
- pip --version
- pip list
- git clone https://github.com/andy-maier/ansible.git --branch zhmc-fixes --depth 1 ../ansible
- make develop
- make install
- pip list
- make develop
- pip list
- pip install python-coveralls
- pip list
- 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.

# The module doc build (make docs) generates different order of module
# suboptions between Python 2 and Python 3. Because the docs is generated
# on Python 2 and then checked in to the repo, the make doccheck needs to be
# run on Python 2 only.
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 && $PACKAGE_LEVEL == latest ]]; then
make doccheck;
fi

# commands to run builds & tests
script:
Expand All @@ -184,4 +221,6 @@ script:
- make test

after_success:
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 && $PACKAGE_LEVEL == latest ]]; then coveralls; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" && "$PACKAGE_LEVEL" == "latest" ]]; then
coveralls;
fi
10 changes: 6 additions & 4 deletions Makefile
Expand Up @@ -38,9 +38,11 @@ ifndef PACKAGE_LEVEL
endif
ifeq ($(PACKAGE_LEVEL),minimum)
pip_level_opts := -c minimum-constraints.txt
pip_level_opts_new :=
else
ifeq ($(PACKAGE_LEVEL),latest)
pip_level_opts := --upgrade --upgrade-strategy eager
pip_level_opts := --upgrade
pip_level_opts_new := --upgrade-strategy eager
else
$(error Error: Invalid value for PACKAGE_LEVEL variable: $(PACKAGE_LEVEL))
endif
Expand Down Expand Up @@ -210,15 +212,15 @@ help:
.PHONY: install
install: _pip requirements.txt setup.cfg setup.py
@echo 'Installing package (as editable) and its reqs with PACKAGE_LEVEL=$(PACKAGE_LEVEL) into current Python environment'
$(PIP_CMD) install $(pip_level_opts) -r requirements.txt
$(PIP_CMD) install $(pip_level_opts) -e .
$(PIP_CMD) install $(pip_level_opts) $(pip_level_opts_new) -r requirements.txt
$(PIP_CMD) install -e .
@echo 'Done: Installed package and its reqs into current Python environment.'

.PHONY: develop
develop: _pip requirements.txt dev-requirements.txt os_setup.sh $(ansible_repo_dir)
@echo 'Setting up the development environment with PACKAGE_LEVEL=$(PACKAGE_LEVEL)'
bash -c './os_setup.sh'
$(PIP_CMD) install $(pip_level_opts) -r dev-requirements.txt
$(PIP_CMD) install $(pip_level_opts) $(pip_level_opts_new) -r dev-requirements.txt
@echo '$@ done.'

.PHONY: docs
Expand Down