This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
52 lines (43 loc) · 1.41 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
sudo: required
language: objective-c
# Reference for OS X Versions:
# https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
matrix:
include:
- os: osx
osx_image: xcode10
install:
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../:../roles:./roles'; } >> ansible.cfg"
# Add a hosts file.
- sudo mkdir -p /etc/ansible
- sudo touch /etc/ansible/hosts
- "echo -e '[local]\nlocalhost ansible_connection=local' | sudo tee -a /etc/ansible/hosts > /dev/null"
script:
# Get macOS version string.
- macos_version=$(sw_vers -productVersion)
# Install pip (macOS version dependent).
- |
if [[ "$macos_version" == 10.13.* ]]; then
sudo easy_install pip
else
# See: https://stackoverflow.com/a/49748494/100134
curl https://bootstrap.pypa.io/get-pip.py | sudo python
fi
# Install Ansible.
- sudo -H pip install ansible
# Check the role/playbook's syntax.
- "ansible-playbook tests/test.yml --syntax-check"
# Test the playbook.
- "ansible-playbook tests/test.yml"
# Test the playbook's idempotence.
- idempotence=$(mktemp)
- "ansible-playbook tests/test.yml | tee -a ${idempotence}"
- >
tail ${idempotence}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/