From 25bdba929e7b83e539da4b7db3cc59f94c52c32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?= <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de> Date: Thu, 22 Jun 2023 10:01:58 +0200 Subject: [PATCH] Update CI to explicitly test doc building Improve setup script (add prod and CI parameters) Improve calling of setup script in CI configuration Add doc generation action to CI configuration --- .gitlab-ci.yml | 13 +++++++++++-- Utils/setup.sh | 19 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ee3e6cb..342f765f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,8 +18,7 @@ before_script: - python -V # Print out python version for debugging - apt-get -qq update - apt-get -qq install -y python3-virtualenv python3 python3-dev python3-pip gettext default-mysql-client default-libmysqlclient-dev - - export DJANGO_SETTINGS_MODULE=AKPlanning.settings_ci - - ./Utils/setup.sh --prod + - ./Utils/setup.sh --ci - mkdir -p public/badges public/lint - echo undefined > public/badges/$CI_JOB_NAME.score - source venv/bin/activate @@ -70,6 +69,16 @@ lint: codequality: codeclimate.json when: always +doc: + stage: test + script: + - cd docs + - make html + - cd .. + artifacts: + paths: + - docs/_build/html + pages: stage: deploy image: alpine:latest diff --git a/Utils/setup.sh b/Utils/setup.sh index fafa334a..1c951824 100755 --- a/Utils/setup.sh +++ b/Utils/setup.sh @@ -15,6 +15,14 @@ source venv/bin/activate pip install --upgrade setuptools pip wheel pip install -r requirements.txt +# set environment variable when we want to update in production +if [ "$1" = "--prod" ]; then + export DJANGO_SETTINGS_MODULE=AKPlanning.settings_production +fi +if [ "$1" = "--ci" ]; then + export DJANGO_SETTINGS_MODULE=AKPlanning.settings_ci +fi + # Setup database python manage.py migrate @@ -26,9 +34,12 @@ python manage.py compilemessages -l de_DE # Credentials are entered interactively on CLI python manage.py createsuperuser -# Generate documentation -cd docs -make html -cd .. +# Generate documentation (but not for CI use) +if [ -n "$1" = "--ci" ]; then + cd docs + make html + cd .. +fi + deactivate -- GitLab