-
Notifications
You must be signed in to change notification settings - Fork 5
/
.travis.yml
44 lines (31 loc) · 1.31 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
---
language: python
python: "2.7"
sudo: required
dist: trusty
services:
- docker
before_install:
- sudo apt-get install -y curl
install:
# Install Ansible.
- pip install ansible
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ansible/roles/'; echo 'hostfile = ansible/hosts'; } >> ansible.cfg"
script:
# Check the role/playbook's syntax.
- "ansible-playbook ansible/site.yml --syntax-check"
# Build docker image
- docker build -t maestrano/docker-lamp:travis .
# Run image
- docker run -td --name travis-test maestrano/docker-lamp:travis
# Get ip address
- "container_ip=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' travis-test`"
# Wait for ansible to finish running
- sleep 10
# Check that apache is up
- "curl http://${container_ip}:80/"
# Check to make sure we can connect to MySQL via Unix socket.
- docker exec -i travis-test mysql -u root -e 'show databases;' | grep -q 'performance_schema' && (echo 'MySQL running normally' && exit 0) || (echo 'MySQL not running' && exit 1)
# Check to make sure we can connect to MySQL via TCP.
- docker exec -i travis-test mysql -u root -h 127.0.0.1 -e 'show databases;' | grep -q 'performance_schema' && (echo 'MySQL running normally' && exit 0) || (echo 'MySQL not running' && exit 1)