-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
54 lines (43 loc) · 1.74 KB
/
.travis.yml
File metadata and controls
54 lines (43 loc) · 1.74 KB
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
48
49
50
51
52
53
54
---
services: docker
env:
global:
- container_name: test
- vagrant_dir: /var/www/vagrant
- hostname: wordpress.vm
- config_file: config.yml
matrix:
- distro: centos6
init: /sbin/init
- distro: ubuntu1404
init: /sbin/init
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
- '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 -e "@${vagrant_dir}/${config_file}" ${vagrant_dir}/tests/test.yml'
# Basic role syntax check
- 'docker exec -t ${container_name} env TERM=xterm ansible-playbook -e "@${vagrant_dir}/${config_file}" ${vagrant_dir}/provisioning/playbook.yml --syntax-check'
# Test role
- 'docker exec ${container_name} ansible-playbook -e "@${vagrant_dir}/${config_file}" ${vagrant_dir}/provisioning/playbook.yml'
# Check to make sure we can connect to MySQL
- >
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)
# Check to make sure our website is up and running
- >
docker exec ${container_name} curl -s -H Host:${hostname} localhost
| grep -q '<title>WordPress Site'
&& (echo 'WordPress site up' && exit 0)
|| (echo 'WordPress site down' && exit 1)