You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.6 KiB

  1. language: python
  2. python:
  3. - "3.6"
  4. env:
  5. - DATABASE=sqlite
  6. - DATABASE=postgres
  7. - DATABASE=mssql
  8. services:
  9. - docker
  10. before_install:
  11. - docker network create doccano
  12. - >
  13. if [[ "${DATABASE}" = "postgres" ]]; then
  14. docker run --rm --name=postgres --network=doccano -d -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=db postgres
  15. export DATABASE_URL="postgres://user:pass@postgres:5432/db?sslmode=disable"
  16. elif [[ "${DATABASE}" = "mssql" ]]; then
  17. docker run --rm --name=mssql --network=doccano -d -e ACCEPT_EULA=y -e SA_PASSWORD=sUp3rS3cr3t mcr.microsoft.com/mssql/server:2017-latest
  18. docker exec -it mssql sh -c "while ! /opt/mssql-tools/bin/sqlcmd -U SA -P sUp3rS3cr3t -Q 'CREATE DATABASE db;'; do sleep 3; done"
  19. export DATABASE_URL="mssql://SA:sUp3rS3cr3t@mssql:1433/db?sslmode=disable"
  20. fi
  21. install:
  22. - pip install mkdocs mkdocs-material
  23. script:
  24. - docker build --target=builder --tag=doccano-test .
  25. - >
  26. if [[ "${DATABASE}" != "sqlite" ]]; then
  27. 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'
  28. fi
  29. before_deploy:
  30. - mkdocs build --verbose --clean
  31. deploy:
  32. - provider: script
  33. script: tools/cd.sh travis-${TRAVIS_BUILD_NUMBER}
  34. on:
  35. branch: master
  36. - provider: script
  37. script: tools/cd.sh ${TRAVIS_TAG}
  38. on:
  39. tags: true
  40. - provider: pages
  41. skip_cleanup: true
  42. github_token: $GITHUB_TOKEN
  43. local_dir: site
  44. on:
  45. branch: master