language: python python: - "3.6" env: - DATABASE=sqlite # - DATABASE=postgres # - DATABASE=mssql # - DATABASE=mysql services: - docker before_install: - docker network create doccano - > if [[ "${DATABASE}" = "postgres" ]]; then docker run --rm --name=postgres --network=doccano -d -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=db postgres export DATABASE_URL="postgres://user:pass@postgres:5432/db?sslmode=disable" elif [[ "${DATABASE}" = "mssql" ]]; then docker run --rm --name=mssql --network=doccano -d -e ACCEPT_EULA=y -e SA_PASSWORD=sUp3rS3cr3t mcr.microsoft.com/mssql/server:2017-latest docker exec -it mssql sh -c "while ! /opt/mssql-tools/bin/sqlcmd -U SA -P sUp3rS3cr3t -Q 'CREATE DATABASE db;'; do sleep 3; done" export DATABASE_URL="mssql://SA:sUp3rS3cr3t@mssql:1433/db?sslmode=disable" elif [[ "${DATABASE}" = "mysql" ]]; then docker run --rm --name=mysql --network=doccano -d -e MYSQL_DATABASE=db -e MYSQL_ROOT_PASSWORD=mysqlr00t mysql:5.7 export DATABASE_URL="mysql://root:mysqlr00t@mysql:3306/db" fi install: - pip install --no-cache-dir mkdocs==1.1 mkdocs-material==4.6.3 script: - docker build --target=runtime --tag=doccano-test . - > if [[ "${DATABASE}" != "sqlite" ]]; then docker run --network doccano -e DATABASE_URL="${DATABASE_URL}" -it doccano-test sh -c 'app/manage.py wait_for_db && app/manage.py migrate && app/manage.py test api.tests server.tests' fi before_deploy: - mkdocs build --verbose --clean deploy: - provider: script script: tools/cd.sh travis-${TRAVIS_BUILD_NUMBER} on: repo: doccano/doccano branch: master - provider: script script: tools/cd.sh ${TRAVIS_TAG} on: repo: doccano/doccano tags: true - provider: pages skip_cleanup: true github_token: $GITHUB_TOKEN local_dir: site on: repo: doccano/doccano branch: master