mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2025-02-16 12:38:28 +00:00
Fixes #17 (for real): Add macOS Travis CI tests.
This commit is contained in:
parent
28ccee33e9
commit
ed459f49f9
1 changed files with 46 additions and 0 deletions
46
.travis.yml
Normal file
46
.travis.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
sudo: required
|
||||
language: objective-c
|
||||
# 10.11 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version)
|
||||
osx_image: xcode7.3
|
||||
|
||||
before_install:
|
||||
# Uninstall existing brew installation.
|
||||
- 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"'
|
||||
- rm -rf /usr/local/Homebrew
|
||||
- rm -rf /usr/local/Caskroom
|
||||
- rm -rf /usr/local/bin/brew
|
||||
|
||||
install:
|
||||
# Install pip.
|
||||
- sudo easy_install pip
|
||||
|
||||
# Install Ansible.
|
||||
- sudo pip install ansible
|
||||
|
||||
# Add ansible.cfg to pick up roles path.
|
||||
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> 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:
|
||||
# Install dependencies.
|
||||
- "ansible-galaxy install -r requirements.yml"
|
||||
|
||||
# Check the role/playbook's syntax.
|
||||
- "ansible-playbook main.yml --syntax-check"
|
||||
|
||||
# Test the playbook.
|
||||
- "ansible-playbook main.yml"
|
||||
|
||||
# Test the playbook's idempotence.
|
||||
- idempotence=$(mktemp)
|
||||
- "ansible-playbook main.yml | tee -a ${idempotence}"
|
||||
- >
|
||||
tail ${idempotence}
|
||||
| grep -q 'changed=0.*failed=0'
|
||||
&& (echo 'Idempotence test: pass' && exit 0)
|
||||
|| (echo 'Idempotence test: fail' && exit 1)
|
Loading…
Add table
Reference in a new issue