From d62baac66345ed735443cbb648e684923fed7d17 Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Wed, 19 Dec 2018 09:52:21 -0500 Subject: Added Travis testing --- .yamllint.yml | 58 +++++++++++++++++++++++++++++++++++++++++ setup_travis_tests.sh | 18 +++++++++++++ tests/.ansible-lint | 2 ++ tests/Dockerfile.centos-7 | 27 +++++++++++++++++++ tests/Dockerfile.debian-jessie | 14 ++++++++++ tests/Dockerfile.debian-stretch | 13 +++++++++ tests/Dockerfile.fedora-24 | 26 ++++++++++++++++++ tests/Dockerfile.fedora-25 | 26 ++++++++++++++++++ tests/Dockerfile.fedora-26 | 26 ++++++++++++++++++ tests/Dockerfile.fedora-27 | 26 ++++++++++++++++++ tests/Dockerfile.fedora-28 | 26 ++++++++++++++++++ tests/Dockerfile.fedora-29 | 26 ++++++++++++++++++ tests/Dockerfile.ubuntu-bionic | 13 +++++++++ tests/Dockerfile.ubuntu-trusty | 14 ++++++++++ tests/Dockerfile.ubuntu-xenial | 13 +++++++++ 15 files changed, 328 insertions(+) create mode 100644 .yamllint.yml create mode 100755 setup_travis_tests.sh create mode 100644 tests/.ansible-lint create mode 100644 tests/Dockerfile.centos-7 create mode 100644 tests/Dockerfile.debian-jessie create mode 100644 tests/Dockerfile.debian-stretch create mode 100644 tests/Dockerfile.fedora-24 create mode 100644 tests/Dockerfile.fedora-25 create mode 100644 tests/Dockerfile.fedora-26 create mode 100644 tests/Dockerfile.fedora-27 create mode 100644 tests/Dockerfile.fedora-28 create mode 100644 tests/Dockerfile.fedora-29 create mode 100644 tests/Dockerfile.ubuntu-bionic create mode 100644 tests/Dockerfile.ubuntu-trusty create mode 100644 tests/Dockerfile.ubuntu-xenial diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..9c7cac4 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,58 @@ +--- +extends: default + +rules: + braces: + # Defaults + # min-spaces-inside: 0 + # max-spaces-inside: 0 + + # Keeping 0 min-spaces to not error on empty collection definitions + min-spaces-inside: 0 + # Allowing one space inside braces to improve code readability + max-spaces-inside: 1 + + brackets: + # Defaults + # min-spaces-inside: 0 + # max-spaces-inside: 0 + + # Keeping 0 min-spaces to not error on empty collection definitions + min-spaces-inside: 0 + # Allowing one space inside braces to improve code readability + max-spaces-inside: 1 + + colons: + # Defaults + # max-spaces-before: 0 + # max-spaces-after: 1 + + max-spaces-before: 0 + # Allowing more than one space for code readability + max-spaces-after: -1 + + comments: + # Defaults + # level: warning + # require-starting-space: true + # min-spaces-from-content: 2 + + # Disabling to allow for code comment blocks and #!/usr/bin/ansible-playbook + require-starting-space: false + + indentation: + # Defaults + # spaces: consistent + # indent-sequences: true + # check-multi-line-strings: false + + # Requiring 2 space indentation + spaces: 2 + # Requiring consistent indentation within a file, either indented or not + indent-sequences: consistent + + # Disabling due to copious amounts of long lines in the code which would + # require a code style change to resolve + line-length: disable + + truthy: disable diff --git a/setup_travis_tests.sh b/setup_travis_tests.sh new file mode 100755 index 0000000..302e659 --- /dev/null +++ b/setup_travis_tests.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +TRAVIS_TEST_VER="v1.6.2" + +TAR_FILE="$TRAVIS_TEST_VER.tar.gz" + +# Prompt for Ansible role name +read -r -p "Enter the Ansible role name: " input + +# Update .travis.yml with Ansible role name +sed -i '' "s/replace_role/${input}/g" ".travis.yml" + +# Update tests/test.yml with Ansible role name +sed -i '' "s/replace_role/${input}/g" "tests/test.yml" + +# Cleanup +if [ -f $TAR_FILE ]; then + rm $TAR_FILE +fi diff --git a/tests/.ansible-lint b/tests/.ansible-lint new file mode 100644 index 0000000..7dfbb8f --- /dev/null +++ b/tests/.ansible-lint @@ -0,0 +1,2 @@ +skip_list: + - "503" diff --git a/tests/Dockerfile.centos-7 b/tests/Dockerfile.centos-7 new file mode 100644 index 0000000..1ad757e --- /dev/null +++ b/tests/Dockerfile.centos-7 @@ -0,0 +1,27 @@ +FROM centos:7 +ENV container=docker + +RUN yum -y install epel-release && \ + yum -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-pip python-setuptools python-virtualenv \ + redhat-rpm-config && \ + yum -y group install "Development Tools" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.debian-jessie b/tests/Dockerfile.debian-jessie new file mode 100644 index 0000000..2bb5bc2 --- /dev/null +++ b/tests/Dockerfile.debian-jessie @@ -0,0 +1,14 @@ +FROM debian:jessie +ENV container=docker + +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential libffi-dev \ + libssl-dev python-dev python-minimal python-pip python-setuptools \ + python-virtualenv && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install --upgrade pip setuptools && \ + pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / diff --git a/tests/Dockerfile.debian-stretch b/tests/Dockerfile.debian-stretch new file mode 100644 index 0000000..c1187b8 --- /dev/null +++ b/tests/Dockerfile.debian-stretch @@ -0,0 +1,13 @@ +FROM debian:stretch +ENV container=docker + +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential libffi-dev \ + libssl-dev python-dev python-minimal python-pip python-setuptools \ + python-virtualenv systemd && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / diff --git a/tests/Dockerfile.fedora-24 b/tests/Dockerfile.fedora-24 new file mode 100644 index 0000000..b2a83cc --- /dev/null +++ b/tests/Dockerfile.fedora-24 @@ -0,0 +1,26 @@ +FROM fedora:24 +ENV container=docker + +RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-dnf python-pip python-setuptools python-virtualenv \ + redhat-rpm-config systemd && \ + dnf -y group install "C Development Tools and Libraries" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.fedora-25 b/tests/Dockerfile.fedora-25 new file mode 100644 index 0000000..16fa871 --- /dev/null +++ b/tests/Dockerfile.fedora-25 @@ -0,0 +1,26 @@ +FROM fedora:25 +ENV container=docker + +RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-dnf python-pip python-setuptools python-virtualenv \ + redhat-rpm-config systemd && \ + dnf -y group install "C Development Tools and Libraries" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.fedora-26 b/tests/Dockerfile.fedora-26 new file mode 100644 index 0000000..dd8a954 --- /dev/null +++ b/tests/Dockerfile.fedora-26 @@ -0,0 +1,26 @@ +FROM fedora:26 +ENV container=docker + +RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-dnf python-pip python-setuptools python-virtualenv \ + redhat-rpm-config systemd && \ + dnf -y group install "C Development Tools and Libraries" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.fedora-27 b/tests/Dockerfile.fedora-27 new file mode 100644 index 0000000..15474da --- /dev/null +++ b/tests/Dockerfile.fedora-27 @@ -0,0 +1,26 @@ +FROM fedora:27 +ENV container=docker + +RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-dnf python-pip python-setuptools python-virtualenv \ + redhat-rpm-config systemd && \ + dnf -y group install "C Development Tools and Libraries" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.fedora-28 b/tests/Dockerfile.fedora-28 new file mode 100644 index 0000000..1885bc7 --- /dev/null +++ b/tests/Dockerfile.fedora-28 @@ -0,0 +1,26 @@ +FROM fedora:28 +ENV container=docker + +RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-dnf python-pip python-setuptools python-virtualenv \ + redhat-rpm-config systemd && \ + dnf -y group install "C Development Tools and Libraries" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.fedora-29 b/tests/Dockerfile.fedora-29 new file mode 100644 index 0000000..3f94b36 --- /dev/null +++ b/tests/Dockerfile.fedora-29 @@ -0,0 +1,26 @@ +FROM fedora:29 +ENV container=docker + +RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \ + python-devel python-dnf python-pip python-setuptools python-virtualenv \ + redhat-rpm-config systemd && \ + dnf -y group install "C Development Tools and Libraries" + +# Install systemd -- See https://hub.docker.com/_/centos/ +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 pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/usr/sbin/init"] diff --git a/tests/Dockerfile.ubuntu-bionic b/tests/Dockerfile.ubuntu-bionic new file mode 100644 index 0000000..07116b6 --- /dev/null +++ b/tests/Dockerfile.ubuntu-bionic @@ -0,0 +1,13 @@ +FROM ubuntu:bionic +ENV container=docker + +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential libffi-dev \ + libssl-dev python-dev python-minimal python-pip python-setuptools \ + python-virtualenv systemd && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / diff --git a/tests/Dockerfile.ubuntu-trusty b/tests/Dockerfile.ubuntu-trusty new file mode 100644 index 0000000..b1645da --- /dev/null +++ b/tests/Dockerfile.ubuntu-trusty @@ -0,0 +1,14 @@ +FROM ubuntu:trusty +ENV container=docker + +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential libffi-dev \ + libssl-dev python-dev python-minimal python-pip python-setuptools \ + python-virtualenv && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install --upgrade pip setuptools && \ + pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / diff --git a/tests/Dockerfile.ubuntu-xenial b/tests/Dockerfile.ubuntu-xenial new file mode 100644 index 0000000..188f255 --- /dev/null +++ b/tests/Dockerfile.ubuntu-xenial @@ -0,0 +1,13 @@ +FROM ubuntu:xenial +ENV container=docker + +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential libffi-dev \ + libssl-dev python-dev python-minimal python-pip python-setuptools \ + python-virtualenv && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install enum34 ipaddress wheel && \ + pip install ansible ansible-lint + +COPY .ansible-lint / -- cgit v1.2.3