forked from rapidpro/rapidpro-docker
-
Notifications
You must be signed in to change notification settings - Fork 12
/
.travis.yml
92 lines (81 loc) · 4.89 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
sudo: required
language: python
services:
- docker
cache:
directories:
- $HOME/postgresql
env:
global:
- GREP_TIMEOUT=360
- REGISTRY_USER=rapidproautomation
# NOTE: this is generated with `travis encrypt REGISTRY_PASS="the-password"`
# which is decrypted by Travis CI and set as environment variables
- secure: "ZEp6Zahblytf+53HNnrCEZ0teQJFrBlS2+6NrGJk+pbutkG1nTUQzZrbPRiJwj61Xh/AHkWnUsKvFUF8P6wJLLXklEZMFid0G9Y7pBmcSNmtrVTl6WySQDGAHKb7X+6CAftQX443bcrjIKRgHLkBfC4ZQWXjqfwQrlBrJsdDrLFJjl/v6aYlst92kbSBcA0gi8/1rFiNlUZdh7SqG5GI52LOjL6F4LwLkcAe0m+RTGOjwfv+jIG4xXFZme0EOeRqxM2LXLSrCbZFu7MvE7fDJrTwiAX4R+iEsV8LNwYfX8L1b5NUzrSBbgClfSHnA02wWLnrsVQJbSqipiwB5pHntA8/4aRHzkZrdPTowZtk4QG5Ngp/f7kZ014v4l90HDIEmcDATsKzalf/VoLsUrcZhU4dokXkXb6M4yogYKKMbGSwOVmlKahRCEs8LI+tbPH0nGey5h/Mg1OFysmFHMM6z/krGmDZi+4LRLLcybuXXAZELeNMzPJQgSTlYAftuXPftQwuseRS4pg+Heb4NHzToG7KqTwV642G03x2UHmQ6rfB9Ld50KBr7ZGIcMKqvUGtVKS5ZI+wCeDdg2u4YbvMTNGd0srNX8Rdn51PzlGJZHOe6e8ZzGRNZocmb/LUjSn2YOj0gz9GoIMjKgQstGY7HoEGJ5/yfZ9Q/KU2kyIpfPk="
- secure: KwcHx5aUsgtmkqC0mt06di9kuqskbvsrbjnVU/YvFz1mwB2vw5v7keAWcnpglB1gb99GKGVx9H5FzmZBqStl5pILbnIIpf5+UhHKSG4kEHXoG/amZApiI0Aks9Iq87DdYlSknCtz/Q66zZlxaHx4GNJCtcRI6wQyEngQhYYeobPJTg040BLIoXVBP7qnqd3yGMwSgLAg+/M6Ro6f2ZkMEXAit48bxQNhG1YyjDevGQnvZIGW/FnAszfNkuBp59ivMSsNp8fb2B4+Xn3RHs3Vdz4m6zqyLsHx/ZFonHynlrsQk0cIQ4xyN1KpzvgzdXVeo8f1IzXqCNczo6FsiGnSAJq0WPrRU77ie9nsCYlsiB7KescUJ3xHNPHxCFflfV6SBsgLLyAmA6gFZP+uLRovVDJpuATc6VJrFRkMTH9fLhbNdg+uBlz2v4zlfDmmfm8pxtXV7CZNnHM2LODUzNKv7pVYLezXmQUe9c1Kj3Q57rgG7rsY4OSZZM0B6Qn82SDI77hm7i3dZVloMxaEMuj0v1c7v5BFEL0Bfr2qSjdGgYJmWiL5lgH6eFc23NficE13SAlc7UeY/ZWNuAfn/LMI1M3NfIDhjTY5rDByfeOKzf9It9fSFjiYZFoRH7RHkbGUvGtBsycMKqG7kt+V6XoOx2kUcaQQc9KH8KJ4b+fBrFA=
matrix:
- IMAGE="praekeltfoundation/rapidpro" VERSION="v5.6.5" REPO="praekeltfoundation/rapidpro"
- IMAGE="praekeltfoundation/rapidpro" VERSION="v6.5.71" REPO="praekeltfoundation/rapidpro"
# - IMAGE="praekeltfoundation/rapidpro" VERSION="master" REPO="praekeltfoundation/rapidpro"
# Update Docker Engine
before_install:
- sudo apt-get update
- sudo apt-get install -qy -o Dpkg::Options::="--force-confold" docker-ce coreutils
# Commented the below out as we removed cached postgresql dump
# before_cache:
# - docker exec --user=postgres postgresql pg_dump rapidpro > $HOME/postgresql/rapidpro.sql
before_script:
- 'curl -H "Authorization: Bearer $GITHUB_ACCESS_TOKEN" -s https://api.github.com/repos/$REPO/tags | tee ./tags.json'
- LATEST_TAG=$(cat ./tags.json | jq -r '.[0].name')
- VERSION=${VERSION:-$LATEST_TAG}
install:
- echo "preventing default pip install here"
script:
# Setup postgresql and load sql dump if exists
- docker pull mdillon/postgis:9.6
- docker run -d --name postgresql -e POSTGRES_DB=rapidpro mdillon/postgis:9.6
- timeout $GREP_TIMEOUT grep -m 1 'PostgreSQL init process complete; ready for start up.' <(docker logs --follow postgresql 2>&1)
# Load the cached postgresql dump to speed up migrations -- this is commented out for now
# - if [[ -f $HOME/postgresql/rapidpro.sql ]]; then cat $HOME/postgresql/rapidpro.sql | docker exec -i --user=postgres postgresql psql rapidpro; fi
# Setup redis
- docker pull redis:alpine
- docker run -d --name redis redis:alpine
- timeout $GREP_TIMEOUT grep -m 1 'Ready to accept connections' <(docker logs --follow redis 2>&1)
# Build RapidPro and run it
- docker pull rapidpro/rapidpro-base:v4
- docker pull "$IMAGE"
- >
docker build --pull --cache-from "$IMAGE" \
--tag "$IMAGE" \
--build-arg RAPIDPRO_VERSION=$VERSION \
--build-arg RAPIDPRO_REPO=$REPO \
.
- >
docker run --name rapidpro \
--env-file docker.envfile \
--link redis \
--link postgresql \
--publish 8000:8000 \
--detach \
"$IMAGE"
- timeout $GREP_TIMEOUT grep -m 1 'static files copied' <(docker logs --follow rapidpro 2>&1)
- timeout $GREP_TIMEOUT grep -m 1 'Compressing... done' <(docker logs --follow rapidpro 2>&1)
- timeout $GREP_TIMEOUT grep -m 1 'Running migrations' <(docker logs --follow rapidpro 2>&1)
# See docker.envfile for the switch to turn this on. Defaults to off because these API
# calls are subject to GitHub's rate limiting of Travis CI IPs
# - timeout $GREP_TIMEOUT grep -m 1 'Downloading geojson for relation_ids 192796' <(docker logs --follow rapidpro 2>&1)
# - timeout $GREP_TIMEOUT grep -m 1 'Imported geojson for relation_ids 192796' <(docker logs --follow rapidpro 2>&1)
- timeout $GREP_TIMEOUT grep -m 1 'spawned uWSGI http 1' <(docker logs --follow rapidpro 2>&1)
- docker exec rapidpro /venv/bin/python /rapidpro/manage.py check
after_script:
- docker logs rapidpro
- docker images
before_deploy:
- pip install docker-ci-deploy==0.3.0
- echo -n $REGISTRY_PASS | docker login -u "$REGISTRY_USER" --password-stdin
deploy:
provider: script
skip_cleanup: true
script: dcd --tag-version "$VERSION" --tag-semver --tag-latest "$IMAGE"
on:
branch: master