forked from doccano/doccano
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
64 lines (52 loc) · 1.92 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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=builder --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