-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.travis.yml
50 lines (43 loc) · 3.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
45
46
47
48
49
50
---
# Adapted from https://blog.travis-ci.com/2017-11-30-testing-ansible-roles-using-docker-on-travis
language: generic
sudo: required
env:
global:
- DISTRIBUTION="ubuntu"
matrix:
- VERSION="focal" ROS_DISTRO="noetic"
- VERSION="bionic" ROS_DISTRO="melodic"
- VERSION="xenial" ROS_DISTRO="kinetic"
jobs:
allow_failures: # https://github.com/ansible/ansible/issues/68645
- env: VERSION="focal" ROS_DISTRO="noetic"
services:
- docker
before_install:
- 'sudo docker pull ${DISTRIBUTION}:${VERSION}'
- 'sudo docker build --no-cache --rm --file=travis/Dockerfile.${DISTRIBUTION}-${VERSION} --tag=${DISTRIBUTION}-${VERSION}:ansible travis'
script:
- container_id=$(mktemp)
- 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/ansible-role-ros:ro ${DISTRIBUTION}-${VERSION}:ansible > "${container_id}"'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-ros/tests/test.yml --syntax-check'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-ros/tests/test.yml'
- >
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-ros/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- 'sudo docker exec "$(cat ${container_id})" bin/bash -c "[ -f /opt/ros/${ROS_DISTRO}/setup.bash ] && (echo setup.bash exists under /opt/ros/${ROS_DISTRO}/ && exit 0) || (echo setup.bash not found under /opt/ros/${ROS_DISTRO}/ && exit 1)"'
- 'sudo docker exec "$(cat ${container_id})" bin/bash -c "[ -f /home/${DISTRIBUTION}/catkin_ws/devel/setup.bash ] && (echo setup.bash exists under /home/${DISTRIBUTION}/catkin_ws/devel/ && exit 0) || (echo setup.bash not found under /home/${DISTRIBUTION}/catkin_ws/devel/ && exit 1)"'
- 'sudo docker exec "$(cat ${container_id})" bin/bash -c "[ -f /home/${DISTRIBUTION}/ros_ws/devel/setup.bash ] && (echo setup.bash exists under /home/${DISTRIBUTION}/ros_ws/devel/ && exit 0) || (echo setup.bash not found under /home/${DISTRIBUTION}/ros_ws/devel/ && exit 1)"'
- 'sudo docker exec "$(cat ${container_id})" bin/bash -c "[ -f /home/${DISTRIBUTION}/colcon_ws/install/setup.bash ] && (echo setup.bash exists under /home/${DISTRIBUTION}/colcon_ws/install/ && exit 0) || (echo setup.bash not found under /home/${DISTRIBUTION}/colcon_ws/install/ && exit 1)"'
# - 'sudo docker exec "$(cat ${container_id})" bin/bash -c "grep -q "source /opt/ros/${ROS_DISTRO}/setup.bash" /home/ubuntu/.bashrc; [ $? -eq 0 ]
# && (echo ~/.bashrc sources /opt/ros/${ROS_DISTRO}/setup.bash && exit 0)
# || (echo ~/.bashrc does source /opt/ros/${ROS_DISTRO}/setup.bash && exit 1)'
# - >
# sudo docker exec "$(cat ${container_id})" bin/bash -c 'grep -q "source /home/${DISTRIBUTION}/catkin_ws/devel/setup.bash" /home/ubuntu/.bashrc; [ $? -eq 0 ]
# && (echo ~/.bashrc sources /home/${DISTRIBUTION}/catkin_ws/devel/setup.bash && exit 0)
# || (echo ~/.bashrc does source /home/${DISTRIBUTION}/catkin_ws/devel/setup.bash && exit 1)'
- 'sudo docker rm -f "$(cat ${container_id})"'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/