Commit bf129f23 authored by hynek's avatar hynek 🤤
Browse files

Merge branch 'develop' into feature/template-base

parents e372e766 8f0896a3
......@@ -10,11 +10,10 @@ include:
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
DS_PIP_DEPENDENCY_PATH: requirements/production.txt
DARIAH_STORAGE_TOKEN: $DH_TOKEN
stages:
- build
......@@ -40,17 +39,16 @@ build_develop:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $CONTAINER_TEST_IMAGE -f compose/local/django/Dockerfile .
- docker push $CONTAINER_TEST_IMAGE
tests:
stage: test
image: tiangolo/docker-with-compose
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- echo "Composing CI setup with $CONTAINER_TEST_IMAGE"
- docker-compose -f ci.yml build
# - docker-compose -f local.yml run --rm django pydocstyle
- docker-compose -f ci.yml run --rm django flake8
- docker-compose -f ci.yml run django coverage run -m pytest
- docker-compose -f ci.yml run django /bin/sh -c "./run_pytest"
- docker-compose -f ci.yml run --rm django coverage html
- docker-compose -f ci.yml run --rm django /bin/sh -c "cd docs && apk add make && make html"
- docker-compose -f ci.yml run django coverage report
......@@ -60,14 +58,15 @@ tests:
- htmlcov
- docs/_build
expire_in: 5 days
except:
allow_failure: true
except:
- master
code_quality:
stage: test
artifacts:
paths: [gl-code-quality-report.json]
except:
except:
- master
dependency_scanning:
......@@ -93,13 +92,13 @@ container_scanning:
create_release:
image: node:8
stage: release
script:
script:
- npm install
- npx semantic-release
only:
- master
release_image:
stage: deploy
script:
......
============================
Contributing to Discuss Data
============================
As an open source project, Discuss Data welcomes contributions of many forms.
Examples of contributions include:
* Code patches
* Documentation improvements
* Bug reports and patch reviews
Felix Herrmann, Stefan Hynek, Ubbo Veentjer
Felix Herrmann
Stefan Hynek
Ubbo Veentjer
......@@ -52,6 +52,12 @@ Running type checks with mypy:
$ mypy discuss_data
Django unit tests
^^^^^^^^^^^^
::
$ docker-compose -f local.yml run django python manage.py test
Test coverage
^^^^^^^^^^^^^
......@@ -60,13 +66,6 @@ To run the tests, check your test coverage, and generate an HTML coverage report
$ docker-compose -f local.yml run django coverage run -m pytest
$ docker-compose -f local.yml run django coverage report
Running tests with py.test
~~~~~~~~~~~~~~~~~~~~~~~~~~
::
$ pytest
Live reloading and Sass CSS compilation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......
......@@ -4,6 +4,6 @@ set -o errexit
set -o pipefail
set -o nounset
python manage.py makemigrations
python manage.py migrate
python manage.py runserver_plus 0.0.0.0:8000
......@@ -81,11 +81,14 @@ THIRD_PARTY_APPS = [
LOCAL_APPS = [
# "discuss_data.users.apps.UsersConfig",
# Your stuff: custom apps go here
"discuss_data.ddusers.apps.DdusersConfig",
"discuss_data.dddatasets.apps.DddatasetsConfig",
"discuss_data.ddcomments.apps.DdcommentsConfig",
"discuss_data.core.apps.CoreConfig",
"discuss_data.ddpublications.apps.DdpublicationsConfig",
"discuss_data.ddusers", # discuss_data.ddusers.apps.DdusersConfig does not work
"discuss_data.dddatasets",
"discuss_data.ddcomments",
"discuss_data.core",
"discuss_data.ddpublications",
"discuss_data.dhrep",
"discuss_data.pages",
"discuss_data.utils",
]
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
......@@ -292,7 +295,6 @@ INSTALLED_APPS += ["compressor"]
STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]
# Your stuff...
# ------------------------------------------------------------------------------
INSTALLED_APPS += ["corsheaders"]
# Wagtail
......@@ -312,9 +314,9 @@ INSTALLED_APPS += [
# 'condensedinlinepanel',
"wagtailmenus",
"modelcluster",
"pages",
]
MIDDLEWARE += [
"wagtail.core.middleware.SiteMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
......
......@@ -49,3 +49,8 @@ EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
# Your stuff...
# ------------------------------------------------------------------------------
DARIAH_STORAGE_LOCATION = "https://cdstar.de.dariah.eu/test/dariah/"
DARIAH_PUBLISH_URL = "https://trep.de.dariah.eu/1.0/dhpublish/"
# put fresh DARIAH_STORAGE_TOKEN to .env for integration tests
DARIAH_STORAGE_TOKEN = env("DARIAH_STORAGE_TOKEN", default="SET-FOR-INTEGRATION-TEST")
......@@ -6,7 +6,8 @@ from django.views.generic import TemplateView
from django.views import defaults as default_views
from django.contrib.auth import views as auth_views
from ddusers.views import dashboard_page
from discuss_data.ddusers.views import dashboard_page
import discuss_data.dddatasets
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.documents import urls as wagtaildocs_urls
......@@ -27,9 +28,8 @@ urlpatterns = [
# path("accounts/", include("allauth.urls")),
# Your stuff: custom urls includes go here
path("core/", include(("core.urls", "core"), namespace="core")),
path(
"dataset/", include(("dddatasets.urls", "dddatasets"), namespace="dddatasets")
),
path("dataset/", include("discuss_data.dddatasets.urls", namespace="dddatasets"),),
path("dhrep/", include("discuss_data.dhrep.urls", namespace="dhrep")),
path(
"login/",
auth_views.LoginView.as_view(template_name="auth/login.html",),
......
import pytest
from django.conf import settings
from django.test import RequestFactory
from discuss_data.users.tests.factories import UserFactory
# pytest finds added options only in root conftest.py if not configured otherwise
def pytest_addoption(parser):
parser.addoption(
"--integration",
action="store_true",
default=False,
help="run integration tests",
)
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> settings.AUTH_USER_MODEL:
return UserFactory()
@pytest.fixture
def request_factory() -> RequestFactory:
return RequestFactory()
# list marker if requested with 'pytest --markers'
def pytest_configure(config):
config.addinivalue_line("markers", "integration: mark a test as integration test")
......@@ -28,7 +28,7 @@ class Migration(migrations.Migration):
validators=[_simple_domain_name_validator],
),
),
("name", models.CharField(max_length=50, verbose_name="display name")),
("name", models.CharField(max_length=50, verbose_name="display name"),),
],
options={
"ordering": ("domain",),
......
......@@ -20,7 +20,7 @@ def update_site_backward(apps, schema_editor):
"""Revert site domain and name to default."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID, defaults={"domain": "example.com", "name": "example.com"}
id=settings.SITE_ID, defaults={"domain": "example.com", "name": "example.com"},
)
......
......@@ -266,7 +266,7 @@ class Migration(migrations.Migration):
(
"tag",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.EnTagged"
on_delete=django.db.models.deletion.CASCADE, to="core.EnTagged",
),
),
],
......
from django.urls import resolve
from django import template
from ddusers.models import User
from discuss_data.ddusers.models import User
register = template.Library()
DEFAULT_USER_IMAGE = "/static/images/user_default.png"
......
from django.conf.urls import handler403
from django.urls import path
from core import views
from discuss_data.core import views
app_name = "core"
......
......@@ -11,7 +11,7 @@ from guardian.core import ObjectPermissionChecker
# from core.models import AffiliationTagged
# from core.models import Topic # data
# from core.models import KeywordTags
from core.models import KeywordTagged
from discuss_data.core.models import KeywordTagged
# from core.models import LanguageTagged
......
......@@ -19,7 +19,8 @@ class Migration(migrations.Migration):
model_name="comment",
name="user",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
]
......@@ -17,7 +17,7 @@ from crispy_forms.layout import (
)
from crispy_forms.bootstrap import FormActions, TabHolder, Tab
from dddatasets.models import DataSet, DataFile
from discuss_data.dddatasets.models import DataSet, DataFile
UPDATED_MSG = """
{% if updated %}<div id='updated-msg' class='alert alert-success' ic-trigger-on='scrolled-into-view' ic-action='delay:2500;fadeOut;remove' ic-target='#updated-msg' role='alert'>
......
......@@ -30,19 +30,19 @@ from django.forms import ModelForm
from django.template.loader import render_to_string
from django.core.files.base import ContentFile
from ddusers.models import User
from ddusers.models import Institution
from discuss_data.ddusers.models import User
from discuss_data.ddusers.models import Institution
from ddcomments.models import Comment
from discuss_data.ddcomments.models import Comment
from core.models import Topic # data
from core.models import KeywordTags
from core.models import KeywordTagged
from core.models import LanguageTagged
from core.models import LanguageTags
from core.models import Link
from discuss_data.core.models import Topic # data
from discuss_data.core.models import KeywordTags
from discuss_data.core.models import KeywordTagged
from discuss_data.core.models import LanguageTagged
from discuss_data.core.models import LanguageTags
from discuss_data.core.models import Link
from utils import cropped_thumbnail
from discuss_data.utils import cropped_thumbnail
from actstream import action
......
from django.urls import path
from dddatasets import views
from discuss_data.dddatasets import views
from dddatasets import views_prep
from discuss_data.dddatasets import views_prep
app_name = "dddatasets"
......
......@@ -2,9 +2,9 @@ from django.http import Http404
from weasyprint import HTML
from dddatasets.models import DataSet, DataSetManagementObject, DataFile
from discuss_data.dddatasets.models import DataSet, DataSetManagementObject, DataFile
from pages.models import ManualPage
from discuss_data.pages.models import ManualPage
def check_published(uuid):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment