From 26af6c2d2553cd99d61639cf71a252fe0cbf60ab Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 8 Jul 2016 08:28:30 -0700 Subject: [PATCH] Add module integration tests on shippable. --- shippable.yml | 48 +++++++++++++++++++++++++++ test/utils/shippable/ci.sh | 7 ++++ test/utils/shippable/integration.sh | 51 +++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 shippable.yml create mode 100755 test/utils/shippable/ci.sh create mode 100755 test/utils/shippable/integration.sh diff --git a/shippable.yml b/shippable.yml new file mode 100644 index 00000000000..5385520ba30 --- /dev/null +++ b/shippable.yml @@ -0,0 +1,48 @@ +language: python + +env: + matrix: + - TEST=none + +matrix: + exclude: + - env: TEST=none + include: + - env: TEST=integration IMAGE=ansible/ansible:centos6 + - env: TEST=integration IMAGE=ansible/ansible:centos7 + - env: TEST=integration IMAGE=ansible/ansible:fedora-rawhide + - env: TEST=integration IMAGE=ansible/ansible:fedora23 + - env: TEST=integration IMAGE=ansible/ansible:opensuseleap + - env: TEST=integration IMAGE=ansible/ansible:ubuntu1204 PRIVILEGED=true + - env: TEST=integration IMAGE=ansible/ansible:ubuntu1404 PRIVILEGED=true + - env: TEST=integration IMAGE=ansible/ansible:ubuntu1604 +build: + pre_ci_boot: + options: "--privileged=false --net=bridge" + ci: + - test/utils/shippable/ci.sh + +integrations: + notifications: + - integrationName: email + type: email + on_success: never + on_failure: never + on_start: never + on_pull_request: never + - integrationName: irc + type: irc + recipients: + - "chat.freenode.net#ansible-notices" + on_success: change + on_failure: always + on_start: never + on_pull_request: always + - integrationName: slack + type: slack + recipients: + - "#shippable" + on_success: change + on_failure: always + on_start: never + on_pull_request: never diff --git a/test/utils/shippable/ci.sh b/test/utils/shippable/ci.sh new file mode 100755 index 00000000000..5c0f847e661 --- /dev/null +++ b/test/utils/shippable/ci.sh @@ -0,0 +1,7 @@ +#!/bin/bash -eux + +set -o pipefail + +source_root=$(python -c "from os import path; print(path.abspath(path.join(path.dirname('$0'), '../../..')))") + +"${source_root}/test/utils/shippable/${TEST}.sh" 2>&1 | gawk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; fflush(); }' diff --git a/test/utils/shippable/integration.sh b/test/utils/shippable/integration.sh new file mode 100755 index 00000000000..f67fd59db67 --- /dev/null +++ b/test/utils/shippable/integration.sh @@ -0,0 +1,51 @@ +#!/bin/bash -eux + +set -o pipefail + +ansible_repo_url="https://github.com/ansible/ansible.git" + +is_pr="${IS_PULL_REQUEST}" +build_dir="${SHIPPABLE_BUILD_DIR}" +repo="${REPO_NAME}" + +if [ "${is_pr}" != "true" ]; then + echo "Module integration tests are only supported on pull requests." + exit 1 +fi + +case "${repo}" in + "ansible-modules-core") + this_module_group="core" + other_module_group="extras" + ;; + "ansible-modules-extras") + this_module_group="extras" + other_module_group="core" + ;; + *) + echo "Unsupported repo name: ${repo}" + exit 1 + ;; +esac + +modules_tmp_dir="${build_dir}.tmp" +this_modules_dir="${build_dir}/lib/ansible/modules/${this_module_group}" +other_modules_dir="${build_dir}/lib/ansible/modules/${other_module_group}" + +cd / +mv "${build_dir}" "${modules_tmp_dir}" +git clone "${ansible_repo_url}" "${build_dir}" +cd "${build_dir}" +rmdir "${this_modules_dir}" +mv "${modules_tmp_dir}" "${this_modules_dir}" +mv "${this_modules_dir}/shippable" "${build_dir}" +git submodule init "${other_modules_dir}" +git submodule sync "${other_modules_dir}" +git submodule update "${other_modules_dir}" + +pip install -r test/utils/shippable/modules/generate-tests-requirements.txt --upgrade +pip list + +source hacking/env-setup + +test/utils/shippable/modules/generate-tests "${this_module_group}" --verbose | /bin/bash -eux