diff --git a/.travis.yml b/.travis.yml index 603132f722c..9c9788db1a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,20 @@ -sudo: false +sudo: required +services: + - docker language: python matrix: include: - - env: TOXENV=py24 INTEGRATION=no - - env: TOXENV=py26 INTEGRATION=yes + - env: TARGET=sanity TOXENV=py24 + - env: TARGET=sanity TOXENV=py26 python: 2.6 - - env: TOXENV=py27 INTEGRATION=yes + - env: TARGET=sanity TOXENV=py27 python: 2.7 - - env: TOXENV=py34 INTEGRATION=no + - env: TARGET=sanity TOXENV=py34 python: 3.4 - - env: TOXENV=py35 INTEGRATION=no + - env: TARGET=sanity TOXENV=py35 python: 3.5 + - env: TARGET=centos7 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + - env: TARGET=ubuntu1404 addons: apt: sources: @@ -18,16 +22,8 @@ addons: packages: - python2.4 install: - - pip install tox PyYAML Jinja2 sphinx + - pip install tox script: -# urllib2's defaults are not secure enough for us -- ./test/code-smell/replace-urlopen.sh . -- ./test/code-smell/use-compat-six.sh lib -- ./test/code-smell/boilerplate.sh -- ./test/code-smell/required-and-default-attributes.sh -- if test x"$TOXENV" != x'py24' ; then tox ; fi -- if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi - #- make -C docsite all -- if test x"$INTEGRATION" = x'yes' ; then source ./hacking/env-setup && cd test/integration/ && make parsing && make test_var_precedence && make unicode ; fi + - ./test/utils/run_tests.sh after_success: - coveralls diff --git a/test/utils/docker/centos7/Dockerfile b/test/utils/docker/centos7/Dockerfile new file mode 100644 index 00000000000..8994461171c --- /dev/null +++ b/test/utils/docker/centos7/Dockerfile @@ -0,0 +1,48 @@ +# Latest version of centos +FROM centos:centos7 +ENV LC_ALL en_US.UTF-8 + +#RUN yum -y swap fakesystemd systemd +RUN yum -y update; yum clean all; yum -y swap fakesystemd systemd + +RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*; \ +rm -f /etc/systemd/system/*.wants/*; \ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*; \ +rm -f /lib/systemd/system/anaconda.target.wants/*; + +RUN yum -y install \ + dbus-python \ + epel-release \ + git \ + make \ + mercurial \ + rubygems \ + subversion \ + sudo \ + unzip \ + which + +RUN yum -y install \ + PyYAML \ + python-coverage \ + python-httplib2 \ + python-jinja2 \ + python-keyczar \ + python-mock \ + python-nose \ + python-paramiko \ + python-pip \ + python-setuptools \ + python-virtualenv + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers +RUN mkdir /etc/ansible/ +RUN echo -e '[local]\nlocalhost' > /etc/ansible/hosts + +VOLUME /sys/fs/cgroup /run /tmp +ENV container=docker +CMD ["/usr/sbin/init"] diff --git a/test/utils/docker/ubuntu1404/Dockerfile b/test/utils/docker/ubuntu1404/Dockerfile new file mode 100644 index 00000000000..d65d4a28a45 --- /dev/null +++ b/test/utils/docker/ubuntu1404/Dockerfile @@ -0,0 +1,34 @@ +FROM ubuntu:trusty +ENV LC_ALL en_US.UTF-8 + +RUN apt-get clean; apt-get update -y; + +RUN apt-get install -y \ + debianutils \ + git \ + make \ + mercurial \ + ruby \ + subversion \ + sudo \ + unzip + +RUN apt-get install -y \ + python-coverage \ + python-httplib2 \ + python-jinja2 \ + python-keyczar \ + python-mock \ + python-nose \ + python-paramiko \ + python-pip \ + python-setuptools \ + python-virtualenv \ + python-yaml + +RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers +RUN mkdir /etc/ansible/ +RUN echo -e '[local]\nlocalhost' > /etc/ansible/hosts + +VOLUME /sys/fs/cgroup /run /tmp +ENV container=docker diff --git a/test/utils/run_tests.sh b/test/utils/run_tests.sh new file mode 100755 index 00000000000..58ee87e7012 --- /dev/null +++ b/test/utils/run_tests.sh @@ -0,0 +1,15 @@ +#!/bin/sh -x + +if [ "${TARGET}" = "sanity" ]; then + ./test/code-smell/replace-urlopen.sh . + ./test/code-smell/use-compat-six.sh lib + ./test/code-smell/boilerplate.sh + ./test/code-smell/required-and-default-attributes.sh + if test x"$TOXENV" != x'py24' ; then tox ; fi + if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi +else + docker build -t ansible_test/${TARGET} test/utils/docker/${TARGET} + docker run -d --volume="${PWD}:/root/ansible" ${TARGET_OPTIONS} ansible_test/${TARGET} > /tmp/cid_${TARGET} + docker exec -ti $(cat /tmp/cid_${TARGET}) /bin/sh -c 'cd /root/ansible; . hacking/env-setup; make tests && (cd test/integration; make)' + docker kill $(cat /tmp/cid_${TARGET}) +fi