forked from lookit/lookit-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
49 lines (38 loc) · 1.36 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
# Config file for automatic testing at travis-ci.org
sudo: true
dist: trusty
services:
- docker
- postgresql
env:
global:
- DOCKER_REPO_URL=quay.io
- DOCKER_REPO_OWNER=lookit
- DOCKER_REPO_NAME=lookit-api
- DOCKER_BRANCH=${TRAVIS_BRANCH/\//-}
- DOCKER_IMAGE_URL=$DOCKER_REPO_URL/$DOCKER_REPO_OWNER/$DOCKER_REPO_NAME
- PGPORT=5432
cache:
directories:
- $HOME/docker
notifications:
slack: lookit-mit:Sc6ZVxrtb0vIiXtft93BtXNI
addons:
postgresql: "9.6"
#before_script:
# - sudo service postgresql start
# We don't need the line to create the new database, apparently
# - psql -c 'create database travis_ci_test;' -U postgres
jobs:
include:
- stage: Build & Test
script:
- bash -c 'until pg_isready; do sleep 1; done'
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull $DOCKER_IMAGE_URL:$TRAVIS_COMMIT || docker pull $DOCKER_IMAGE_URL:$DOCKER_BRANCH || true
- docker build
--file travis.Dockerfile
--cache-from $DOCKER_IMAGE_URL:$TRAVIS_COMMIT --cache-from $DOCKER_IMAGE_URL:$DOCKER_BRANCH
--build-arg GIT_COMMIT=$TRAVIS_COMMIT --build-arg GIT_TAG=$TRAVIS_TAG
--pull -t $DOCKER_IMAGE_URL:$TRAVIS_COMMIT .
- docker run --rm -it --network="host" $DOCKER_IMAGE_URL:$TRAVIS_COMMIT python manage.py test