Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Travis test #1

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
language: python
os: osx
sudo: required

env:
- ANSIBLE_VERSION: "2.3.2.0"
- ANSIBLE_VERSION: "2.4.3.0"

before_install:
- ./tests/installPython.sh

install:
# Install Ansible.
- sudo pip install ansible

# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"

# Check if ansible cfg was created correctly
- cat ansible.cfg

script:
- echo "Tests to be defined"
- ansible-playbook -i tests/inventory tests/test.yml --syntax-check

# Run the role/playbook with ansible-playbook.
- sudo ansible-playbook -i tests/inventory tests/test.yml --connection=local

# Run the role/playbook again, checking to make sure it's idempotent.
#- >
# sudo ansible-playbook -i tests/inventory tests/test.yml --connection=local
# | grep -q 'changed=0.*failed=0'
# && (echo 'Idempotence test: pass' && exit 0)
# || (echo 'Idempotence test: fail' && exit 1)

notifications:
# Always send email notification
Expand Down
81 changes: 81 additions & 0 deletions tests/installPython.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

set -e
set -x

if [[ "$(uname -s)" == 'Darwin' ]]; then
sw_vers
brew update || brew update

brew outdated openssl || brew upgrade openssl
brew install [email protected]

# install pyenv
git clone --depth 1 https://github.com/pyenv/pyenv ~/.pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

case "${TOXENV}" in
py27)
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
;;
py33)
pyenv install 3.3.6
pyenv global 3.3.6
;;
py34)
pyenv install 3.4.6
pyenv global 3.4.6
;;
py35)
pyenv install 3.5.3
pyenv global 3.5.3
;;
py36)
pyenv install 3.6.1
pyenv global 3.6.1
;;
pypy*)
pyenv install "$PYPY_VERSION"
pyenv global "$PYPY_VERSION"
;;
pypy3)
pyenv install pypy3-2.4.0
pyenv global pypy3-2.4.0
;;
docs)
brew install enchant
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
;;
esac
pyenv rehash
sudo easy_install pip
python -m pip install --user virtualenv
else
# download, compile, and install if it's not already present via travis
# cache
if [ -n "${OPENSSL}" ]; then
OPENSSL_DIR="ossl-1/${OPENSSL}"
if [[ ! -f "$HOME/$OPENSSL_DIR/bin/openssl" ]]; then
curl -O https://www.openssl.org/source/openssl-$OPENSSL.tar.gz
tar zxf openssl-$OPENSSL.tar.gz
cd openssl-$OPENSSL
./config shared no-asm no-ssl2 no-ssl3 -fPIC --prefix="$HOME/$OPENSSL_DIR"
# modify the shlib version to a unique one to make sure the dynamic
# linker doesn't load the system one. This isn't required for 1.1.0 at the
# moment since our Travis builders have a diff shlib version, but it doesn't hurt
sed -i "s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=100/" Makefile
sed -i "s/^SHLIB_MINOR=.*/SHLIB_MINOR=0.0/" Makefile
sed -i "s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=100.0.0/" Makefile
make depend
make install
fi
fi
pip install virtualenv
fi

python -m virtualenv ~/.venv
source ~/.venv/bin/activate
1 change: 1 addition & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
254 changes: 254 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
---
- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "airport", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "applicationaccess", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "applicationaccessnew", state: "present" }
roles:
- role: macos_profile

#- hosts: localhost
# remote_user: root
# vars:
# - mobileconfig: { template: "directory", state: "present" }
# roles:
# - role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "disableautoupdates", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "dock", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "energysaver", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "familycontrols", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "finder", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "gatekeeper", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "loginitems", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "loginwindow", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "menuextras", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "munki", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "safari", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "sal", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "skipsetup", state: "present" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "softwareupdate", state: "present" }
roles:
- role: macos_profile

# Remove profiles again

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "airport", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "applicationaccess", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "applicationaccessnew", state: "absent" }
roles:
- role: macos_profile

#- hosts: localhost
# remote_user: root
# vars:
# - mobileconfig: { template: "directory", state: "absent" }
# roles:
# - role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "disableautoupdates", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "dock", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "energysaver", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "familycontrols", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "finder", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "gatekeeper", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "loginitems", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "loginwindow", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "menuextras", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "munki", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "safari", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "sal", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "skipsetup", state: "absent" }
roles:
- role: macos_profile

- hosts: localhost
remote_user: root
vars:
- mobileconfig: { template: "softwareupdate", state: "absent" }
roles:
- role: macos_profile