From dbc702199042abf9cfea51781427c7f97800d6ac Mon Sep 17 00:00:00 2001 From: Jonas Winkler Date: Thu, 12 Nov 2020 17:12:58 +0100 Subject: [PATCH] trying to make travis work. --- .travis.yml | 59 ++++++++------------------------------- docker-compose.yml | 2 +- src/documents/index.py | 3 ++ src/paperless/settings.py | 8 +++--- src/setup.cfg | 2 +- 5 files changed, 20 insertions(+), 54 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa1785d8d..44b0b7c5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,56 +1,19 @@ language: python -before_install: -- sudo apt-get update -qq -- sudo apt-get install -qq libpoppler-cpp-dev unpaper tesseract-ocr - -sudo: false - -matrix: - include: - - python: "3.5" - - python: "3.6" - - python: "3.7-dev" - - env: - - BUILD_DOCKER=1 - # Variable to add to publish the Docker image: - # * DOCKER_USERNAME - # * DOCKER_PASSWORD, to be encrypted, use `travis encrypt DOCKER_PASSWORD=` - services: - - docker - before_install: - - true - install: - - true - script: - - docker build --tag=the-paperless-project/paperless . - after_success: - - true +python: + - "3.6" + - "3.7" + - "3.8" + - "3.9" install: - - pip install --upgrade pip pipenv sphinx - - pipenv lock -r > requirements.txt - - pip install -r requirements.txt + - pip install --upgrade pipenv + - pipenv install --dev script: - - cd src/ - - pytest --cov - - pycodestyle - - sphinx-build -b html ../docs ../docs/_build -W + - cd src/ + - pipenv run pytest --cov + - pipenv run pycodestyle after_success: - - coveralls - -deploy: - - provider: script - skip_cleanup: true - script: ci/deploy-docker - on: - tags: true - condition: '"${BUILD_DOCKER}" = 1' - - provider: script - skip_cleanup: true - script: ci/deploy-docker - on: - branch: master - condition: '"${BUILD_DOCKER}" = 1' + - pipenv run coveralls diff --git a/docker-compose.yml b/docker-compose.yml index 54f293f90..47a549d34 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: POSTGRES_PASSWORD: paperless webserver: - image: paperless-ng:latest + image: jonaswinkler/paperless-ng:latest restart: always depends_on: - db diff --git a/src/documents/index.py b/src/documents/index.py index 82a35a63e..39471ea51 100644 --- a/src/documents/index.py +++ b/src/documents/index.py @@ -70,6 +70,9 @@ def open_index(recreate=False): if exists_in(settings.INDEX_DIR) and not recreate: return open_dir(settings.INDEX_DIR) else: + # TODO: this is not thread safe. If 2 instances try to create the index + # at the same time, this fails. This currently prevents parallel + # tests. return create_in(settings.INDEX_DIR, get_schema()) diff --git a/src/paperless/settings.py b/src/paperless/settings.py index 38721c00f..597e6dc15 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -203,11 +203,11 @@ DATABASES = { } } -# Always have sqlite available as a second option for management commands -# This is important when migrating to/from sqlite -DATABASES['sqlite'] = DATABASES['default'].copy() - if os.getenv("PAPERLESS_DBHOST"): + # Have sqlite available as a second option for management commands + # This is important when migrating to/from sqlite + DATABASES['sqlite'] = DATABASES['default'].copy() + DATABASES["default"] = { "ENGINE": "django.db.backends.postgresql_psycopg2", "HOST": os.getenv("PAPERLESS_DBHOST"), diff --git a/src/setup.cfg b/src/setup.cfg index f9572519b..b09b8d4bb 100644 --- a/src/setup.cfg +++ b/src/setup.cfg @@ -4,7 +4,7 @@ exclude = migrations, paperless/settings.py, .tox [tool:pytest] DJANGO_SETTINGS_MODULE=paperless.settings -addopts = --pythonwarnings=all -n auto +addopts = --pythonwarnings=all env = PAPERLESS_PASSPHRASE=THISISNOTASECRET PAPERLESS_SECRET=paperless