-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff05645
commit 22d6cfe
Showing
3 changed files
with
79 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,53 @@ | ||
--- | ||
language: phyton | ||
python: "2.7" | ||
|
||
sudo: required | ||
|
||
language: python | ||
services: | ||
- docker | ||
env: | ||
global: | ||
- role: weareinteractive.pm2 | ||
matrix: | ||
- distribution: Ubuntu | ||
distribution_version: "16.04" | ||
init: /lib/systemd/systemd | ||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" | ||
deps: curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get update && apt-get install -y nodejs npm | ||
- distribution: Ubuntu | ||
distribution_version: "14.04" | ||
init: /sbin/init | ||
run_opts: "" | ||
deps: curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get update && apt-get install -y nodejs npm | ||
|
||
before_install: | ||
- docker pull williamyeh/ansible:ubuntu14.04 | ||
- sudo apt-get update | ||
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce | ||
- docker pull ansiblecheck/ansiblecheck:"${distribution,,}"-"${distribution_version}" | ||
|
||
script: | ||
- make test | ||
- container_id=$(mktemp) | ||
# Start The Built Container In The Background | ||
- docker run --detach --volume="${PWD}":/etc/ansible/roles/${role}:ro ${run_opts} ansiblecheck/ansiblecheck:"${distribution,,}"-"${distribution_version}" "${init}" > "${container_id}" | ||
|
||
# Print ansible version | ||
- docker exec -t "$(cat ${container_id})" env TERM=xterm ansible --version | ||
|
||
# Install dependencies | ||
- docker exec --tty "$(cat ${container_id})" env TERM=xterm bash -c ${deps} | ||
|
||
# Ansible syntax check. | ||
- docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/${role}/tests/main.yml --syntax-check | ||
|
||
# Test role. | ||
- docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook /etc/ansible/roles/${role}/tests/main.yml | ||
|
||
# Test Idempotence | ||
- idempotence=$(mktemp) | ||
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/${role}/tests/main.yml | tee -a ${idempotence} | ||
- > | ||
tail ${idempotence} | ||
| grep -q 'failed=0' | ||
&& (echo 'Idempotence test: pass' && exit 0) | ||
|| (echo 'Idempotence test: fail' && exit 1) | ||
notifications: | ||
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters