From dd7680023cee65522d071d20e3f87e54ca2b58dd Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Tue, 7 Feb 2017 16:34:37 +0200 Subject: [PATCH] - Seperate tests (pre-commit and molecule) using tox. --- .gitignore | 1 + .travis.yml | 24 +++++++++++------------- molecule.yml | 4 ++++ tox.ini | 22 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index e1cf205..966ef05 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __pycache__ .vagrant/ *.log *.retry +.tox diff --git a/.travis.yml b/.travis.yml index 110a35a..211dd1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,14 +8,15 @@ env: global: - VBOX_MEMORY=2048 matrix: - - platform: openbsd60 - - &openbsd59 platform=openbsd59 - - platform: xenial - - platform: trusty - - platform: precise - - &stretch platform=stretch - - platform: jessie - - platform: wheezy + - TOXENV=pre-commit + - TOXENV=openbsd60 + - &openbsd59 TOXENV=openbsd59 + - TOXENV=xenial + - TOXENV=trusty + - TOXENV=precise + - &stretch TOXENV=stretch + - TOXENV=jessie + - TOXENV=wheezy matrix: fast_finish: True allow_failures: @@ -32,13 +33,10 @@ install: - sudo apt-get install -y linux-headers-$(uname -r) virtualbox - wget https://releases.hashicorp.com/vagrant/1.9.1/vagrant_1.9.1_x86_64.deb - sudo dpkg -i vagrant_1.9.1_x86_64.deb - - pip install -r tests/requirements.txt | cat - - ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles - - molecule dependency + - pip install tox | cat script: - - pre-commit run --all-files - - travis_wait 45 molecule test --platform $platform + - travis_wait 45 tox notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/molecule.yml b/molecule.yml index eb1bc5a..da87f7a 100644 --- a/molecule.yml +++ b/molecule.yml @@ -5,6 +5,10 @@ ansible: diff: True config_file: ../ansible.cfg +molecule: + ignore_paths: + - .tox + dependency: name: galaxy requirements_file: tests/requirements.yml diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..9f02b87 --- /dev/null +++ b/tox.ini @@ -0,0 +1,22 @@ +[tox] +skip_install = True +skipsdist = True +envlist = openbsd60,openbsd59,xenial,trusty,precise,stretch,jessie,wheezy + +[testenv:pre-commit] +deps = -rtests/requirements.txt +whitelist_externals = + sh +commands = + sh -c "ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles" + molecule dependency + pre-commit run --all-files + +[testenv] +deps = -rtests/requirements.txt +passenv = HOME +whitelist_externals = + sh +commands = + sh -c "ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles" + molecule test --platform {envname} -- GitLab