-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
48 lines (37 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
---
services: docker
env:
- distro: centos6
init: /sbin/init
# - distro: centos7
# init: /usr/lib/systemd/systemd
- distro: ubuntu1404
init: /sbin/init
# - distro: ubuntu1604
# init: /lib/systemd/systemd
before_install:
# Pull container to use
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
install:
- 'gem install rubocop'
script:
# Vagrantfile syntax check
- 'rubocop Vagrantfile --except MutableConstant,LineLength'
# Run test container
- 'container_name=test'
- 'vagrant_dir=/var/www/vagrant'
- 'docker run -d --name=${container_name} -v ${PWD}:${vagrant_dir}:rw geerlingguy/docker-${distro}-ansible:latest ${init}'
# Add ansible role requirements
- 'docker exec ${container_name} ansible-galaxy install -r ${vagrant_dir}/requirements.yml'
# Prep test setup
- 'docker exec ${container_name} ansible-playbook ${vagrant_dir}/tests/test.yml'
# Basic role syntax check
- 'docker exec -t ${container_name} env TERM=xterm ansible-playbook ${vagrant_dir}/provisioning/playbook.yml --syntax-check'
# Test role
- 'docker exec ${container_name} ansible-playbook ${vagrant_dir}/provisioning/playbook.yml'
# Check to make sure we can connect to MySQL
- >
sudo docker exec ${container_name} mysql -u root -proot -e 'show databases;'
| grep -q 'information_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)