diff --git a/.zuul.yaml b/.zuul.yaml new file mode 100644 index 0000000..0b0e2cd --- /dev/null +++ b/.zuul.yaml @@ -0,0 +1,43 @@ +- job: + name: ansible-role-nginx-base + run: tests/playbooks/run.yaml + roles: + - zuul: openstack/ansible-role-nginx + +- job: + name: ansible-role-nginx + parent: ansible-role-nginx-base + +- job: + name: ansible-role-nginx-fedora-27 + parent: ansible-role-nginx + nodeset: fedora-27 + +- job: + name: ansible-role-nginx-ubuntu-bionic + parent: ansible-role-nginx + nodeset: ubuntu-bionic + +- job: + name: ansible-role-nginx-ubuntu-xenial + parent: ansible-role-nginx + nodeset: ubuntu-xenial + +- project: + name: openstack/ansible-role-nginx + templates: + - windmill-jobs-fedora-27 + - windmill-jobs-bionic + - windmill-jobs-xenial + check: + jobs: + - ansible-role-nginx-fedora-27 + - ansible-role-nginx-ubuntu-bionic + - ansible-role-nginx-ubuntu-xenial + - tox-linters + gate: + jobs: + - ansible-role-nginx-fedora-27 + - ansible-role-nginx-ubuntu-bionic + - ansible-role-nginx-ubuntu-xenial + - tox-linters diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..1f3277f --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,7 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +# this is required for the docs build jobs +sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD +doc8>=0.6.0 # Apache-2.0 diff --git a/requirements.txt b/requirements.txt index 90d4055..f3a3f52 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -ansible +ansible>=2.4.0 diff --git a/test-requirements.txt b/test-requirements.txt index 9ea7158..4c4414f 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,3 +1,2 @@ ansible-lint hacking<0.11,>=0.10 -sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 diff --git a/tests/ansible.cfg b/tests/ansible.cfg deleted file mode 100644 index 6c8a344..0000000 --- a/tests/ansible.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[defaults] -roles_path = ../.. diff --git a/tests/inventory b/tests/inventory index 68b2dac..2fbb50c 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,2 +1 @@ -[all] localhost diff --git a/tests/test.yaml b/tests/playbooks/run.yaml similarity index 76% rename from tests/test.yaml rename to tests/playbooks/run.yaml index 9060b35..84bf321 100644 --- a/tests/test.yaml +++ b/tests/playbooks/run.yaml @@ -1,4 +1,4 @@ -# Copyright 2015 Red Hat, Inc. +# Copyright 2018 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,16 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. --- -- hosts: localhost +- hosts: all vars: - rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" - pre_tasks: - # Make sure OS does not have a stale package cache. - - name: Update apt cache. - become: yes - apt: - update_cache: yes - when: ansible_os_family == 'Debian' + rolename: ansible-role-nginx roles: - "{{ rolename }}" diff --git a/tox.ini b/tox.ini index a340d4a..dc90799 100644 --- a/tox.ini +++ b/tox.ini @@ -8,30 +8,13 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt [testenv:docs] -commands = python setup.py build_sphinx - -[testenv:functional] -commands = - # NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI. - ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER} -passenv = - HOME - USER -setenv = - ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg - PYTHONUNBUFFERED = 1 - -[testenv:linters] -setenv = - ANSIBLE_CONFIG = tests/ansible.cfg -whitelist_externals = bash -commands = - flake8 - bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ - ansible-lint" - bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ - ansible-playbook --syntax-check -i tests/inventory \ - -e rolename=$(basename $(pwd)) > /dev/null" +deps = -r{toxinidir}/doc/requirements.txt +whitelist_externals = + bash +commands= + bash -c "rm -rf doc/build" + doc8 doc + sphinx-build -b html doc/source doc/build/html [testenv:venv] commands = {posargs} @@ -43,3 +26,18 @@ show-source = True ignore = E123,E125 builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build + +[testenv:linters] +setenv = + ANSIBLE_ROLES_PATH = .. +whitelist_externals = bash +commands = + # PEP8 Lint Check + flake8 + # Ansible Lint Check + bash -c "find . -not -path '*/\.*' -type f -regex '.*.y[a]?ml' -print0 | \ + xargs -t -n1 -0 ansible-lint" + # Ansible Syntax Check + bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ + ansible-playbook --syntax-check -i tests/inventory \ + -e rolename=$(basename $(pwd)) > /dev/null"