diff --git a/.gitignore b/.gitignore index 47df2cf2dde2992f9f477a34d7a4d44c3d9a436d..d967abe4dbee1dd0f4d271b531fefbdca08c0669 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ __pycache__ *.log *.retry id_rsa* +.tox diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1fa490069bae414848cd9cc6b5f2450d108d638..13eb0f0645a7773ac752210f1bde980e2b30c859 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,12 +24,7 @@ files: tests/playbook.yml args: - tests/playbook.yml -- repo: local +- repo: https://github.com/adarnimrod/python-pre-commit.git + sha: v0.1.0 hooks: - id: piprot - name: piprot - description: Check up-to-date Python requirements - language: system - entry: piprot --outdated tests/requirements.txt - files: requirements.txt - always_run: true diff --git a/.travis.yml b/.travis.yml index 110a35a5e7721a77d423a0e102c69097f4f76d2c..211dd1bca2db18e80ff9a4c3503735ca67efda9b 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 25f707d797554ae6d44b04a9cd052eee6ad49e5c..1984ae752775234591b975d7314f6529360288bb 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 0000000000000000000000000000000000000000..9f02b87ddc27c541707de71496512c2dbd1bc799 --- /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}