ottertune/.travis.yml

169 lines
9.2 KiB
YAML

dist: bionic
language: python
python:
- 3.6
env:
global:
- DB_NAME=ottertune
- ADMIN_PASSWORD=changeme
- ROOT=$TRAVIS_BUILD_DIR
- WEB=$ROOT/server/website
- CONTROLLER=$ROOT/client/controller
- DRIVER=$ROOT/client/driver
matrix:
include:
- name: Docker
env:
- secure: "JdRlS4MAXv1wMBdQf98r4ugit1v0Emq7S/K3CpyP2jpj0QL0VFhPr/r3GFwq2BRM2y0vXQjD29AoZdiQLv4LULgp4AavcmL3kbD7SNNWileqCLbl3rHdGY1gNW4fYOYCPGMPxntYdm18vpXzoF/A81JUX0MMsw3Wh0dBtiQZQP7O4V+bX5hyuCqlxasfTI0Tl323MWao86I2nSmExvGTcYlissPKGb0+TS+qQjOshvJHtmv0PRxJ2a45fB1h1wkAqGKu0X7fXWAhoo9uPt4T9+oCW6bCklAZPbzm4wc3jurnQ//jS44ThtP4n+xH2mwwU9n0unMKl3I+so+R7nH7pE0YGTD+p/4p8lPXYCLlqllvuhNTf+JXLJoC+lIgQXl4qhtURPokohPxJXNRQRd1SWOyep85h9svX3Z+c3dj5160bM/ArB8jKuFtL1Cq/S7Je+liF3xE25BaFQ5P2DlVM1KxLbtvtaTAcvkxq/jr4zu7ZMAjJtDmF6hsuzflGYqNcElZlhMNtKoGeAfVNmpXvFoLt0Iezbafvc6izAqn/h6A+FKnCgmlOit+TyihqnAtIhj+TBgyOw0TFqJ4QKAb3pqL+FxFrH78yR/HGafNHBfvi6ND3b9BefQ0in2RimSSZbE90pdnxhtSxKUDch3hBd4Q0RxZbA/rRyiKQexxE9M="
- secure: "MdkCbzD+Toqrnz++93EUDf7hOgkP4h8rU42lnHQ5iShnlnwYzMmI90jCFwF5DYThmaDleBn54EB8lsaFcdmjhrhPWPkDhcRZgRAdfCwq+OIV1lH3KbVwBeLnnfKeci+TNldWinoOgS3cFkz+uXm8tFcRZgGJ/IW8Tu/oD9QWZixP7Zyfp28GMzm+6Hmb1lVbpsnMw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lvUXnanmCtrCts="
- BACKEND=postgresql
services:
- docker
before_install:
- docker --version
- docker-compose --version
- env | sort
install: true
before_script:
- sudo service mysql stop || true
- sudo service postgresql stop || true
- cd $ROOT/docker
- docker-compose -f docker-compose.build.yml build --build-arg GIT_COMMIT=$TRAVIS_COMMIT
- 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: true
before_deploy:
- /$ROOT/.travis/before_deploy.sh
deploy:
provider: script
script: /$ROOT/.travis/deploy.sh
on:
repo: cmu-db/ottertune
branch: master
after_deploy:
- curl -LO --retry 3 https://raw.github.com/mernst/plume-lib/master/bin/trigger-travis.sh
- sh trigger-travis.sh --pro --branch master "$TRIGGER_USER" "$TRIGGER_REPO" "$TRIGGER_TOKEN"
- docker logout
- name: Unit 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
- echo "codecov" >> $WEB/requirements.txt
- name: Unit 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
- echo "codecov" >> $WEB/requirements.txt
- name: Integration Tests (MySQL v5.7)
env:
- BACKEND=mysql
services:
- mysql
addons:
apt:
update: true
packages:
- mysql-server
- python-mysqldb
- rabbitmq-server
before_install:
- mysql -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME}"
- sed -i '/psycopg2/d' $WEB/requirements.txt
script:
- cd $WEB && python manage.py runserver 0.0.0.0:8000 &
- sleep 10 && cd $DRIVER && fab integration_tests
after_success: true
- name: Integration Tests (PostgreSQL v9.6)
env:
- BACKEND=postgresql
addons:
postgresql: "9.6"
apt:
update: true
packages:
- rabbitmq-server
before_install:
- psql -U postgres -c "CREATE DATABASE ${DB_NAME}"
- sed -i '/mysqlclient/d' $WEB/requirements.txt
script:
- cd $WEB && python manage.py runserver 0.0.0.0:8000 &
- sleep 10 && cd $DRIVER && fab integration_tests
after_success: true
install:
- pip install -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 $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"