mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-22 03:43:06 +00:00
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
---
|
|
sudo: required
|
|
language: objective-c
|
|
# 10.13 (see https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version)
|
|
osx_image: xcode9.3
|
|
|
|
before_install:
|
|
# Uninstall existing Homebrew installation.
|
|
- curl -sLO https://raw.githubusercontent.com/Homebrew/install/master/uninstall
|
|
- chmod +x ./uninstall
|
|
- ./uninstall --force
|
|
- sudo rm -rf /usr/local/Homebrew
|
|
- sudo rm -rf /usr/local/Caskroom
|
|
- sudo 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"
|
|
|
|
# Copy test config.yml into place.
|
|
- "cp tests/config.yml config.yml"
|
|
|
|
# Test the playbook.
|
|
- "travis_wait 30 ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' main.yml"
|
|
|
|
# Test the playbook's idempotence.
|
|
- idempotence=$(mktemp)
|
|
- "ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' 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)
|