Browse Source
Merge pull request #207 from CatalystCode/enhancement/speed-up-build
Enhancement/Speed up build
pull/219/head
Hiroki Nakayama
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
25 additions and
6 deletions
-
.travis.yml
-
Dockerfile
-
app/app/settings.py
-
app/server/tests/test_api.py
-
app/server/tests/test_models.py
-
tools/ci.sh
|
|
@ -4,7 +4,7 @@ services: |
|
|
|
- docker |
|
|
|
|
|
|
|
script: |
|
|
|
- docker build . |
|
|
|
- docker build --target=builder . |
|
|
|
|
|
|
|
deploy: |
|
|
|
- provider: script |
|
|
|
|
|
@ -24,14 +24,22 @@ COPY . /doccano |
|
|
|
RUN cd /doccano \ |
|
|
|
&& tools/ci.sh |
|
|
|
|
|
|
|
RUN rm -rf /doccano/app/server/node_modules/ |
|
|
|
FROM builder AS cleaner |
|
|
|
|
|
|
|
RUN cd /doccano \ |
|
|
|
&& python app/manage.py collectstatic --noinput |
|
|
|
|
|
|
|
RUN rm -rf /doccano/app/server/node_modules/ \ |
|
|
|
&& rm -rf /doccano/app/server/static/ \ |
|
|
|
&& rm -rf /doccano/app/staticfiles/js/ \ |
|
|
|
&& find /doccano/app/staticfiles -type f -name '*.map*' -delete |
|
|
|
|
|
|
|
FROM python:${PYTHON_VERSION}-slim AS runtime |
|
|
|
|
|
|
|
COPY --from=builder /deps /deps |
|
|
|
RUN pip install --no-cache-dir /deps/*.whl |
|
|
|
|
|
|
|
COPY --from=builder /doccano /doccano |
|
|
|
COPY --from=cleaner /doccano /doccano |
|
|
|
|
|
|
|
ENV DEBUG="True" |
|
|
|
ENV SECRET_KEY="change-me-in-production" |
|
|
|
|
|
@ -94,7 +94,13 @@ TEMPLATES = [ |
|
|
|
] |
|
|
|
|
|
|
|
STATICFILES_DIRS = [ |
|
|
|
path.join(BASE_DIR, 'server/static'), |
|
|
|
static_path |
|
|
|
for static_path in ( |
|
|
|
path.join(BASE_DIR, 'server', 'static', 'bundle'), |
|
|
|
path.join(BASE_DIR, 'server', 'static', 'css'), |
|
|
|
path.join(BASE_DIR, 'server', 'static', 'images'), |
|
|
|
) |
|
|
|
if path.isdir(static_path) |
|
|
|
] |
|
|
|
|
|
|
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' |
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
import os |
|
|
|
|
|
|
|
from django.test import override_settings |
|
|
|
from rest_framework import status |
|
|
|
from rest_framework.reverse import reverse |
|
|
|
from rest_framework.test import APITestCase |
|
|
@ -11,6 +12,7 @@ from ..exceptions import FileParseException |
|
|
|
DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') |
|
|
|
|
|
|
|
|
|
|
|
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage') |
|
|
|
class TestProjectListAPI(APITestCase): |
|
|
|
|
|
|
|
@classmethod |
|
|
@ -70,6 +72,7 @@ class TestProjectListAPI(APITestCase): |
|
|
|
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) |
|
|
|
|
|
|
|
|
|
|
|
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage') |
|
|
|
class TestProjectDetailAPI(APITestCase): |
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
from django.test import TestCase |
|
|
|
from django.test import TestCase, override_settings |
|
|
|
from django.core.exceptions import ValidationError |
|
|
|
from django.db.utils import IntegrityError |
|
|
|
from model_mommy import mommy |
|
|
@ -9,6 +9,7 @@ from ..serializers import SequenceAnnotationSerializer |
|
|
|
from ..serializers import Seq2seqAnnotationSerializer |
|
|
|
|
|
|
|
|
|
|
|
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage') |
|
|
|
class TestTextClassificationProject(TestCase): |
|
|
|
|
|
|
|
@classmethod |
|
|
@ -32,6 +33,7 @@ class TestTextClassificationProject(TestCase): |
|
|
|
self.assertEqual(klass, DocumentAnnotation) |
|
|
|
|
|
|
|
|
|
|
|
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage') |
|
|
|
class TestSequenceLabelingProject(TestCase): |
|
|
|
|
|
|
|
@classmethod |
|
|
@ -55,6 +57,7 @@ class TestSequenceLabelingProject(TestCase): |
|
|
|
self.assertEqual(klass, SequenceAnnotation) |
|
|
|
|
|
|
|
|
|
|
|
@override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.StaticFilesStorage') |
|
|
|
class TestSeq2seqProject(TestCase): |
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
@ -4,7 +4,6 @@ set -o errexit |
|
|
|
|
|
|
|
flake8 |
|
|
|
python app/manage.py migrate |
|
|
|
python app/manage.py collectstatic |
|
|
|
coverage run --source=app app/manage.py test server.tests |
|
|
|
coverage report |
|
|
|
|
|
|
|