mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-22 03:43:06 +00:00
Proper path to playbook under test, and delete the Travisfile.
This commit is contained in:
parent
c14f0dd9a3
commit
2c4ba68d34
2 changed files with 3 additions and 79 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
@ -61,17 +61,17 @@ jobs:
|
|||
ansible-galaxy install -r requirements.yml -p ./roles
|
||||
|
||||
- name: Test the playbook's syntax.
|
||||
run: ansible-playbook tests/test.yml --syntax-check
|
||||
run: ansible-playbook main.yml --syntax-check
|
||||
|
||||
- name: Test the playbook.
|
||||
run: ansible-playbook tests/test.yml
|
||||
run: ansible-playbook main.yml
|
||||
env:
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
|
||||
- name: Idempotence check.
|
||||
run: |
|
||||
idempotence=$(mktemp)
|
||||
ansible-playbook tests/test.yml | tee -a ${idempotence}
|
||||
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)
|
||||
env:
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
|
|
76
.travis.yml
76
.travis.yml
|
@ -1,76 +0,0 @@
|
|||
---
|
||||
sudo: required
|
||||
language: objective-c
|
||||
|
||||
env:
|
||||
global:
|
||||
- ANSIBLE_FORCE_COLOR=true
|
||||
|
||||
# Reference for OS X Versions:
|
||||
# https://docs.travis-ci.com/user/reference/osx/#macos-version
|
||||
matrix:
|
||||
include:
|
||||
# Catalina (10.15)
|
||||
- os: osx
|
||||
osx_image: xcode11.4
|
||||
# Mojave (10.14)
|
||||
- os: osx
|
||||
osx_image: xcode11.3
|
||||
|
||||
before_install:
|
||||
# Install role dependencies. Do this here, using newer OpenSSL version and a
|
||||
# virtualenv because older macOS versions will fail with the system version of
|
||||
# OpenSSL and Python if done later.
|
||||
- brew upgrade openssl || brew install openssl || true
|
||||
- brew upgrade python3 || brew install python3 || true
|
||||
- sudo -H pip3 install -U virtualenv
|
||||
- virtualenv --python=/usr/local/bin/python3 .venv
|
||||
- source .venv/bin/activate
|
||||
- pip3 install ansible
|
||||
- python -c "import ssl; print(ssl.OPENSSL_VERSION)"
|
||||
- ansible-galaxy install -r requirements.yml -p ./roles
|
||||
- deactivate
|
||||
|
||||
# Uninstall existing Homebrew installation.
|
||||
- curl -sLO https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
|
||||
- chmod +x ./uninstall.sh
|
||||
- ./uninstall.sh --force
|
||||
- sudo rm -rf /usr/local/Homebrew
|
||||
- sudo rm -rf /usr/local/Caskroom
|
||||
- sudo rm -rf /usr/local/bin/brew
|
||||
|
||||
# Install Python 3.
|
||||
- curl "https://www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg" -o "python3.pkg"
|
||||
- sudo installer -pkg python3.pkg -target /
|
||||
- export PATH=/Library/Frameworks/Python.framework/Versions/3.7/bin:$PATH
|
||||
|
||||
# Install pip3.
|
||||
- curl https://bootstrap.pypa.io/get-pip.py | sudo python3
|
||||
|
||||
install:
|
||||
# Install Ansible.
|
||||
- sudo -H pip3 install ansible
|
||||
|
||||
# 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:
|
||||
# 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 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…
Reference in a new issue