diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..1ec8b7c480968aa41c296de7641d2d58e9b55a1d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,27 @@ +image: python:latest + +services: + - mysql:5.7 + +variables: + MYSQL_DATABASE: "test" + MYSQL_ROOT_PASSWORD: "mysql" + MYSQL_USER: "django" + MYSQL_PASSWORD: "mysql" + MYSQL_HOST: "mysql" + +cache: + paths: + - ~/.cache/pip/ + +before_script: + - python -V # Print out python version for debugging + - apt-get -qq update + - apt-get -qq install -y python-virtualenv python3 python3-dev python3-pip gettext default-libmysqlclient-dev + - export DJANGO_SETTINGS_MODULE=AKPlanning.settings_ci + - ./Utils/setup.sh --prod + +test: + script: + - source venv/bin/activate + - python manage.py test --settings AKPlanning.settings_ci diff --git a/AKModel/migrations/0017_owner_slug.py b/AKModel/migrations/0017_owner_slug.py index c4fbb31bf88f41938b1687c80df961f64ee3a828..2be7775a01d0e09533db1b85ef218276ecf38273 100644 --- a/AKModel/migrations/0017_owner_slug.py +++ b/AKModel/migrations/0017_owner_slug.py @@ -33,9 +33,8 @@ class Migration(migrations.Migration): migrate_data_forward, migrations.RunPython.noop, ), - migrations.AlterField( - model_name='akowner', - name='slug', - field=models.SlugField(blank=True, help_text='Slug for URL generation', unique=True, max_length=64, verbose_name='Slug') + migrations.AlterUniqueTogether( + name='akowner', + unique_together={('event', 'name', 'institution'), ('event', 'slug')}, ) ] diff --git a/AKModel/migrations/0028_unique_constraints.py b/AKModel/migrations/0028_unique_constraints.py index 2cba695a4379d44d4b0393d1a32d2a12a512b32c..112db71e5b4897e9f880829d4d4d0d744b6afa34 100644 --- a/AKModel/migrations/0028_unique_constraints.py +++ b/AKModel/migrations/0028_unique_constraints.py @@ -38,10 +38,6 @@ class Migration(migrations.Migration): name='akcategory', unique_together={('event', 'name')}, ), - migrations.AlterUniqueTogether( - name='akowner', - unique_together={('event', 'name', 'institution'), ('event', 'slug')}, - ), migrations.AlterUniqueTogether( name='akrequirement', unique_together={('event', 'name')}, diff --git a/AKPlanning/settings_ci.py b/AKPlanning/settings_ci.py new file mode 100644 index 0000000000000000000000000000000000000000..6c09856926dabffa495a333749719278a616d15c --- /dev/null +++ b/AKPlanning/settings_ci.py @@ -0,0 +1,21 @@ +# noinspection PyUnresolvedReferences +from AKPlanning.settings import * + +DEBUG = False +SECRET_KEY = '+7#&=$grg7^x62m#3cuv)k$)tqx!xkj_o&y9sm)@@sgj7_7-!+' + +SESSION_COOKIE_SECURE = True +CSRF_COOKIE_SECURE = True + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'HOST': 'mysql', + 'NAME': 'test', + 'USER': 'django', + 'PASSWORD': 'mysql', + 'OPTIONS': { + 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" + } + } +} diff --git a/Utils/setup.sh b/Utils/setup.sh index 5ccdf50fb72881dcecae76c6db55f7a971da9a7a..aff0b60c07a878917f6031497cb5420c6416e97a 100755 --- a/Utils/setup.sh +++ b/Utils/setup.sh @@ -20,7 +20,7 @@ python manage.py migrate # Prepare static files and translations python manage.py collectstatic --noinput -python manage.py compilemessages +python manage.py compilemessages -l de_DE # Create superuser # Credentials are entered interactively on CLI diff --git a/requirements.txt b/requirements.txt index 646382702dab0b482758fbe2f4d7985c37ef7dc8..ea1f26faff6c67ca94bbb2689b13c7675e65c224 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ django-timezone-field==4.0 djangorestframework==3.11.0 django-simple-history==2.10.0 django-registration-redux==2.8 +mysqlclient==1.4.6 # for production deployment