From d4fea8f6c542f86bcbfaacabea23b1f32149b92b Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Mon, 8 Jul 2019 11:11:20 -0400 Subject: [PATCH 1/2] Replace cd with WORKDIR --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f90f2a24..673a0f0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,8 @@ RUN pip install -r /requirements.txt \ COPY . /doccano -RUN cd /doccano \ - && tools/ci.sh +WORKDIR /doccano +RUN tools/ci.sh FROM builder AS cleaner From ccbb9b0d2fe676e7d099596e61f6fcc16a326126 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Mon, 8 Jul 2019 11:12:01 -0400 Subject: [PATCH 2/2] Run tests against postgres --- .travis.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3e4473e6..aa9392fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,30 @@ language: python python: - "3.6" +env: + - DATABASE=sqlite + - DATABASE=postgres + 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" + fi + install: - pip install mkdocs mkdocs-material script: - - docker build --target=builder . + - 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 migrate && app/manage.py test api.tests server.tests' + fi before_deploy: - mkdocs build --verbose --clean