Skip to content

Commit

Permalink
Merge pull request #5 from iqoption/add-travis
Browse files Browse the repository at this point in the history
Add travis-ci
  • Loading branch information
arslanbekov authored Jan 16, 2018
2 parents d43a2c8 + dae35a6 commit 0abe669
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 12 deletions.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
language: python
python: "2.7"
sudo: required
dist: trusty
services:
- docker

before_install:
- sudo apt-get update -qq

install:
- sudo pip install docker-py
- sudo apt-get install -y sshpass software-properties-common python-software-properties
- sudo apt-add-repository -y ppa:ansible/ansible
- sudo apt-get update -qq
- sudo apt-get install -y ansible
- echo -e 'localhost ansible_connection=local' > tests/inventory
- echo -e '[defaults]\nroles_path = ../\nhostfile = ./tests/inventory' > ansible.cfg
- sudo rm /usr/bin/python && sudo ln -s /usr/bin/python2.7 /usr/bin/python
- ansible --version

script:
- ansible-playbook --syntax-check tests/role.yml
- ansible-playbook -v --diff tests/role.yml
- >
ansible-playbook tests/role.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Selenoid in docker
[![Build Status](https://travis-ci.org/iqoption/selenoid-docker.svg?branch=add-travis)](https://travis-ci.org/iqoption/selenoid-docker)

Set up [selenoid](https://github.com/aerokube/selenoid) in docker

Expand All @@ -12,6 +13,11 @@ Set up [selenoid](https://github.com/aerokube/selenoid) in docker
* `selenoid_cm_version`: [Default: `1.3.1`] Install configuration manager version
* `selenoid_version`: [Default: `1.4.0`] Install selenoid version
* `selenoid_docker_api_version`: [Default: `1.24`] Docker api version (for Selenoid)
* `selenoid_limit`: [Default: `4`] Total number of simultaneously running containers ([full docs](http://aerokube.com/selenoid/latest/#_recommended_docker_settings))
* `selenoid_tmpfs`: [Default: `128`] Add in-memory filesystem (tmpfs) to container ([full docs](http://aerokube.com/selenoid/latest/#_other_optional_fields))
* `selenoid_config_dir`: [Default: `/etc/selenoid`] Selenoid configuration dir
* `selenoid_listen_port`: [Default: `4444`] Listen port
* `selenoid_time_zone`: [Default: `Europe/Moscow`] Timezone in container

#### Example

Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
selenoid_cm_version: 1.3.1
selenoid_version: 1.4.0
selenoid_docker_api_version: 1.24
selenoid_limit: 4
selenoid_tmpfs: 128
selenoid_config_dir: /etc/selenoid
selenoid_listen_port: 4444
selenoid_time_zone: Europe/Moscow
4 changes: 0 additions & 4 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ galaxy_info:
description: Deploy selenoid
company: Iqoption Ltd.
min_ansible_version: 2.2
platforms:
- name: Ubuntu
versions:
- 16.04
17 changes: 9 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
- name: Selenoid | Installing docker-py python package
pip: name=docker-py
- name: Selenoid | Install certain python modules for docker
pip:
name: "{{ item.name }}"
with_items:
- { name: docker-py }

- name: Selenoid | Run CM container, download browser images and run selenoid
docker_container:
Expand All @@ -10,16 +13,14 @@
- "/var/run/docker.sock:/var/run/docker.sock"
- "/root:/root"
env:
TZ: "{{ selenoid_time_zone }}"
OVERRIDE_HOME: "/root"
DOCKER_API_VERSION: "{{ selenoid_docker_api_version }}"
command: >
selenoid start
--config-dir /etc/selenoid/
--vnc
--config-dir {{ selenoid_config_dir }}
--version {{ selenoid_version }}
--tmpfs 128
--last-versions 0
--tmpfs {{ selenoid_tmpfs }}
--env DOCKER_API_VERSION={{ selenoid_docker_api_version }}
--force
--args "-limit 4 -listen :4444 -conf /etc/selenoid/browsers.json -video-output-dir /opt/selenoid/video/"
detach: false
--args "-limit {{ selenoid_limit }} -listen :{{ selenoid_listen_port }} -conf {{ selenoid_config_dir }}/browsers.json"
5 changes: 5 additions & 0 deletions tests/role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: 'localhost'
roles:
- role: 'selenoid-docker'
become: yes
1 change: 1 addition & 0 deletions tests/test-local-inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost ansible_connection=local ansible_python_interpreter=/usr/local/bin/python
5 changes: 5 additions & 0 deletions tests/test-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- { role: ../../selenoid-docker }

0 comments on commit 0abe669

Please sign in to comment.