This repository has been archived by the owner on Nov 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
.travis.yml
53 lines (43 loc) · 1.92 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
51
52
53
language: python
python:
- "3.5"
services:
- docker
cache:
directories:
- $HOME/.cache/pip
env:
global:
- SSL_KEY=nginx.key
- SSL_CERT=nginx.crt
- LETSENCRYPT=false
- DOCKER_REGISTRY_HOST=docker.io
- BOTS_WAIT_TIMEOUT=30
- DEPLOY_TRIGGER_URL=https://bot.radio-t.com:1443/deploy
before_install:
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= pip install docker-compose==1.9.0
- openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj "/C=US/ST=Test/L=Test/O=Dis/CN=localhost" -keyout "etc/ssl/${SSL_KEY}" -out "etc/ssl/${SSL_CERT}"
install:
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= pip install -r ci/requirements.txt
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= docker-compose build
before_script:
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= docker-compose up -d
script:
- set -e
- echo "Waiting nginx-bot to launch on nginx-bot:443..."
- while ! wget --no-check-certificate https://localhost/ping &> /dev/null; do sleep 1; done
- echo "Waiting $BOTS_WAIT_TIMEOUT seconds to ensure if all bots are ready..."; sleep "$BOTS_WAIT_TIMEOUT"
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= BOT_BASE_URL="https://localhost" python ci/run_bot_tests.py . || (docker-compose logs -t && exit 1)
- |
if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker login --username "$DOCKER_REGISTRY_LOGIN" --password "$DOCKER_REGISTRY_PASSWORD" "$DOCKER_REGISTRY_HOST"
docker-compose push
echo "Deploying containers..."
deploy_result=$(curl -X POST \
-u "${DEPLOY_USER}:${DEPLOY_PASSWD}" \
"$DEPLOY_TRIGGER_URL")
echo "$deploy_result"
echo "$deploy_result" | grep -q '"status": "ok"'
fi
after_script:
- docker-compose down