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.

64 lines
1.9 KiB

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