Skip to content

Commit

Permalink
Merge 5e4108a into a8e721e
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-maier committed Sep 21, 2020
2 parents a8e721e + 5e4108a commit 29bc49f
Show file tree
Hide file tree
Showing 63 changed files with 1,655 additions and 1,656 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ jobs:
# cache: pip

before_install:
# Since running 'ansible-test sanity' requires the collection to be tested
# to be located in {...}/collections/ansible_collections/{namespace}/{name},
# we have to move the checked out repo into the required folder structure and
# work from there.
- touch workspace.tar
- tar -cf workspace.tar --exclude=workspace.tar .
- mkdir -p ansible/collections/ansible_collections/ibm/zhmc
- tar -xf workspace.tar --directory ansible/collections/ansible_collections/ibm/zhmc
- cd ansible/collections/ansible_collections/ibm/zhmc

- env | sort

- if [[ "$TRAVIS_BRANCH" == "manual-ci-run" ]]; then
Expand All @@ -153,6 +163,7 @@ before_install:
- if [[ -n $_NEED_REBASE ]]; then git rebase master; fi
- git branch -av


# commands to install dependencies
install:
- which python
Expand Down Expand Up @@ -208,6 +219,11 @@ script:
fi
- make check
- make test
# sanity tests will run for all ansible-supported python versions in a
# docker container, so its enough to run them once
- if [[ $TRAVIS_PYTHON_VERSION == 3.8 && $PACKAGE_LEVEL == latest ]]; then
make sanity;
fi

after_success:
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "3.8" && "$PACKAGE_LEVEL" == "latest" ]]; then
Expand Down
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ python_mn_version := $(shell $(PYTHON_CMD) -c "import sys; sys.stdout.write('%s%
build_dir = build

# Directory with the source code of our Ansible module source files
module_src_dir := $(package_name_python)
module_src_dir := plugins/modules
module_py_files := $(wildcard $(module_src_dir)/zhmc_*.py)

# Directory with test source files
Expand Down Expand Up @@ -202,6 +202,7 @@ help:
@echo ' Env.var TESTCASES can be used to specify a py.test expression for its -k option'
@echo ' all - Do all of the above'
@echo ' end2end - Run end2end tests'
@echo ' sanity - Run ansible sanity tests'
@echo ' upload - Upload the package to PyPI'
@echo ' uninstall - Uninstall package from active Python environment'
@echo ' clobber - Remove any produced files'
Expand Down Expand Up @@ -336,7 +337,9 @@ endif

$(ansible_repo_dir):
@echo 'Cloning our fork of the Ansible repo into: $@'
git clone https://github.com/ansible/ansible.git --branch devel $@
# pinned to a fixed version since the doc generation process has been changed
# in 2.10 (ansibull). TODO: Adapt doc generation.
git clone https://github.com/ansible/ansible.git --branch v2.9.12 $@

$(doc_gen_dir)/list_of_all_modules.rst: Makefile $(module_py_files) $(ansible_repo_dir)
mkdir -p $(doc_gen_dir)
Expand Down Expand Up @@ -375,11 +378,23 @@ $(validate_modules_log_file): Makefile $(module_py_files) $(ansible_repo_dir)

$(test_log_file): Makefile $(check_py_files)
rm -f $@
bash -c 'set -o pipefail; PYTHONWARNINGS=default ANSIBLE_LIBRARY=$(module_src_dir) PYTHONPATH=. py.test -s --cov $(module_src_dir) --cov-config .coveragerc --cov-report=html:htmlcov $(pytest_opts) $(test_dir)/unit $(test_dir)/function 2>&1 |tee $@.tmp'
bash -c 'set -o pipefail; PYTHONWARNINGS=default ANSIBLE_LIBRARY=$(module_src_dir) PYTHONPATH=. pytest -s --cov $(module_src_dir) --cov-config .coveragerc --cov-report=html:htmlcov $(pytest_opts) $(test_dir)/unit $(test_dir)/function 2>&1 |tee $@.tmp'
mv -f $@.tmp $@
@echo 'Done: Created test log file: $@'

.PHONY: end2end
end2end:
bash -c 'PYTHONWARNINGS=default TESTHMCDIR=$(TESTHMCDIR) TESTHMC=$(TESTHMC) py.test -s -v $(pytest_opts) $(test_dir)/end2end'
@echo '$@ done.'

.PHONY: sanity
sanity:
@echo 'Starting sanity tests...'
rm -rf ../ansible
ansible-test sanity --docker
# then uninstall 2.9 and install 2.10 (ansible-base)
pip uninstall -y ansible
pip install ansible-base
# and run the sanity tests with 2.10
ansible-test sanity --docker
@echo '$@ done.'

0 comments on commit 29bc49f

Please sign in to comment.