ottertune/.travis.yml

129 lines
6.7 KiB
YAML
Raw Normal View History

2019-08-23 08:47:19 -07:00
dist: bionic
language: python
python:
- 3.6
2019-08-23 08:47:19 -07:00
env:
global:
- DB_NAME=ottertune
- ADMIN_PASSWORD=changeme
- ROOT=$TRAVIS_BUILD_DIR
- WEB=$ROOT/server/website
- CONTROLLER=$ROOT/client/controller
- DRIVER=$ROOT/client/driver
2019-08-23 08:47:19 -07:00
matrix:
include:
- name: Docker
env:
- BACKEND=postgresql
- secure: PZAe5iDaipqsfzQ0/mjFdcQhEMQ0alI3Ap+hWR0X9uWfK8dH6XU/RJLzJXj2o+kpGiCGlj7DJ9uuJy6+/75hq2f7vcs+6JJInPQHUlkj2TPDYWNWaFw0XvIAvV9EA73l4kDy26m/+JiSaF1GsyVD5wdJpVRmw6o7liGfYlQX3fY8kQ4p51+5ufb9QCAselrE70302fTyX4GqxaT1xC2L5fzzIcuKllFVlRILc+04gldiq8u0EAcUO2ovYiW/3+qGPkDcdwd2j3UC1tEGQ+x+Q/7g5JqBHGz6iMy8omH77p3rk4aKV/HCRTZLQLe/Kcd5UiSrQvSIHl5jfIYbzBx7//Ub64c7TlgX+UckK+GPYiwr2N6VmiducFnSjmm3RSW959m1M+M+bqIPbS510zqnIs28xjqIgnWvtpA8mgKdRAtQyDFMYcLc7GQyw0alUo1CQuTf4+Ter+78vt3vYVlCD8lNoMG78xBaLg//pgNQ8sdGWGbUsAYuxxrqI056Ayw16LgrcakL0JWLR/7p+HmCtH2ZT1nQEZJJHSUP3ekibGrE6wgNVpt3DAOwQUG/JiceLn4uVoeljpT+neCoM29wvf4M7JGWg+8SPtg4DHJIAocOVt5EDi8/CtoIa3WJLD2AMI4ladd4PKNzHT4tsYdE2V9d+xkuhXv1/OakAJedtEc=
- secure: RN4SGagKXgn8gEk9pG2CdM5a/rrBPqkD1nONLcvcqjYzlbniKmhmKT+OxhjVw7Qtoy/RACr4zpIupIjA6COpndSd8/m6WBsWnYD0dt6cDBDLFgHyIh9X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/ybwCIu17JoyaBuQJ/YwYR2se1pojYhFX8kUVpRMn1w+a0D/8UdmEJpwwTZuEsNu6y86IUO6B+Tc+jQbNS/nAWfHrsSiFqPjntLThjRr+Uf+1g0qoyKfK54GHuAAEX9xxOZhA3kfeDlyBaTKaU1efT9/rHGQ1PVcOLPaGzrrQ="
- secure: "Qi5rZ/CSWspEa1JNAPbq9YU7d8ql4JEJs5pQ+Mo+O8SyoMAJzkWGKKk98zTIWfCASZEnckgXMe8jqrhtPq9kmWWulHOR4P9FrO0+JX7Z47hkeXcqJN4LxP3R4BQgZZQCtYpXYfMAEvPs+nJp7IOQ6cTe80Xiz9eAD3385Hpcmz7tiZcgnnc/Eys90RqjK1GZyWRfeekXVvz39e08goW2y4W5DXZWGQ6QDqLr3Wrg7aK6A9e01otNxJGs8eqd12wzkeSiYi8l96taUnLKW9uUIMhhdoDPrHt4o6BjeWmW7OWzWbppcd3oV1IrUo2WngBsamUohL8PYilt/aEDItsdgLb7RBkFoP0prAlOUIPW6Plk34rk4Sk03KFxeBWSXULE+DgGlJZCFobj8MgxW9IQnJBg3Gk6nmadWAA831Aa3LzmC3dhShwQzFrGAxw/xeVHxodUDD0lwVb1UA4EZJuuNCr4/oyDqgjUcSiTHvR+wLdMFzG0+ySnxtoYt+hmTZJaV6ZffFMn8MIdR1tz+W56H+BwJeDxCpGhBuzyYDFDWH3u5Q08lBK3icgpG6wqfCCaZpjCOuGL8GIMkOEtznmGrrYzqsgJ0AbGizahXIQ57Qh/Wob0qVKGXnDqz6jxPH99aRugNa+snp+SaChz6Q5ojY1bbe4jIW03iOY1m51394A="
- DOCKER_REPO="${DOCKER_USER}/ottertune"
- GIT_REPO="ottertune-driver-internal"
services:
- docker
before_install:
- docker --version
- docker-compose --version
- env | sort
install: []
before_script:
- sudo service mysql stop || true
- sudo service postgresql stop || true
- cd $ROOT/docker
- docker-compose -f docker-compose.build.yml build
- dcfile_mysql=docker-compose.mysql.yml
- dcfile_postgres=docker-compose.postgresql.yml
- BACKEND=mysql WEB_ENTRYPOINT="''" sh create-docker-compose.sh $dcfile_mysql
- BACKEND=postgresql WEB_ENTRYPOINT="''" sh create-docker-compose.sh $dcfile_postgres
script:
- docker-compose -f $dcfile_postgres run --workdir="/app" --no-deps --rm web bash -c "pip3 freeze"
- docker-compose -f $dcfile_postgres run --workdir="/app/controller" --no-deps --rm driver gradle build
- docker-compose -f $dcfile_postgres run --workdir="/app" --no-deps --rm web bash -c "python3 -m unittest discover -s analysis/tests -v"
- docker-compose -f $dcfile_postgres run --rm web bash -c "./wait-for-it.sh && python3 manage.py makemigrations website && python3 manage.py test --noinput -v 2"
- docker-compose -f $dcfile_postgres rm -f -s -v
- docker-compose -f $dcfile_mysql run --rm web bash -c "./wait-for-it.sh && python3 manage.py makemigrations website && python3 manage.py test --noinput -v 2"
- docker-compose -f $dcfile_mysql rm -f -s -v
after_success: []
before_deploy:
- /$ROOT/.travis/before_deploy.sh
deploy:
provider: script
script: /$ROOT/.travis/deploy.sh
on:
repo: cmu-db/ottertune
branch: master
2019-08-23 08:47:19 -07:00
- name: Tests (MySQL v5.7)
env:
- BACKEND=mysql
services:
- mysql
addons:
apt:
update: true
packages:
- mysql-server
- python-mysqldb
- rabbitmq-server
- openjdk-11-jdk
- gradle
- checkstyle
before_install:
- mysql -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME}"
- sed -i '/psycopg2/d' $WEB/requirements.txt
2019-08-23 08:47:19 -07:00
- name: Tests (PostgreSQL v9.6)
env:
- BACKEND=postgresql
addons:
postgresql: "9.6"
apt:
update: true
packages:
- rabbitmq-server
- openjdk-11-jdk
- gradle
- checkstyle
before_install:
- psql -U postgres -c "CREATE DATABASE ${DB_NAME}"
- sed -i '/mysqlclient/d' $WEB/requirements.txt
2019-08-23 08:47:19 -07:00
install:
- pip install codecov -r $WEB/requirements.txt
- pip freeze
before_script:
- env | sort
- cd $WEB
- sed -i "s|\('celery', 'db.*$\)|'console', \1|" website/settings/common.py
- cp $ROOT/docker/credentials.py website/settings
- cat website/settings/credentials.py
- python manage.py makemigrations
- python manage.py migrate
- python manage.py startcelery
- python manage.py createuser admin $ADMIN_PASSWORD --superuser
script:
- cd $ROOT/server && coverage run --omit="*/tests/*" -m unittest discover -s analysis/tests -v
- cd $WEB && coverage run manage.py test --noinput -v 2
- cd $CONTROLLER && gradle build
- cd $WEB
- python manage.py runserver 0.0.0.0:8000 &
- sleep 10 && cd $DRIVER && fab integration_tests
- cd $ROOT && git reset --soft ${TRAVIS_COMMIT_RANGE%...*} && git status && git
log | head -n 1 && git lint
after_success:
- >
codecov -F analysis -f "${ROOT}/server/.coverage" ||
(sleep 5 && codecov -F analysis -f "${ROOT}/server/.coverage") ||
(sleep 5 && codecov -F analysis -f "${ROOT}/server/.coverage") &&
echo "Codecov did not collect coverage reports"
- >
codecov -F website -f "${WEB}/.coverage" ||
(sleep 5 && codecov -F website -f "${WEB}/.coverage") ||
(sleep 5 && codecov -F website -f "${WEB}/.coverage") &&
echo "Codecov did not collect coverage reports"