variables: POSTGRES_DB: thalia POSTGRES_USER: postgres POSTGRES_PASSWORD: "" # https://hub.docker.com/r/thalia/python-thalia/ # https://github.com/thaliawww/python-thalia # Should get auto-updated with the official 'python' repository # Installs: # - pip: coverage, poetry # - apt: ghostscript PY36_IMAGE: thalia/python-thalia:3.6 PY37_IMAGE: thalia/python-thalia:3.7 PIP_CACHE_DIR: "${CI_PROJECT_DIR}/pip-cache" stages: - test - deploy codestyle: stage: test image: $PY36_IMAGE before_script: - poetry install --no-interaction script: - poetry run flake8 website # Check for obsolete translations in .po files (starting with `#~`). - cd website - grep --include="*.po" --files-with-matches --recursive "^#~" && exit 1 || echo "No obsolete translations found." # Check for untranslated strings in .po files - empty_strings=$(sed '$a\\' **/locale/nl/LC_MESSAGES/django.po | tac | sed '/^$/N;/\nmsgstr ""$/,/^msgid/!d' | tac) - empty_strings+=$(sed '$a\\' locale/nl/LC_MESSAGES/django.po | tac | sed '/^$/N;/\nmsgstr ""$/,/^msgid/!d' | tac) - if [[ $empty_strings ]]; then echo $empty_strings && exit 1; else echo "No untranslated strings found."; fi # Check for fuzzy translations in .po files - grep --include="*.po" --files-with-matches --recursive "#, fuzzy" && exit 1 || echo "No fuzzy translations found." .djangotest: &djangotest stage: test services: - postgres:latest before_script: - git log -1 - poetry install --no-interaction script: - cd website - poetry run python manage.py check - poetry run python manage.py templatecheck --project-only - poetry run python manage.py makemigrations --no-input --check --dry-run - > poetry run python -Wall -mcoverage run --omit="manage.py,thaliawebsite/wsgi.py,*/migrations/*" --branch --source '.' manage.py test - coverage report python36-django21: <<: *djangotest image: $PY36_IMAGE python37-django21: <<: *djangotest image: $PY37_IMAGE docs: stage: test image: $PY36_IMAGE before_script: # install django deps - poetry install --no-interaction --extras "docs" script: - echo "Building current docs" - cd docs - env -u GITLAB_CI poetry run make doctest - env -u GITLAB_CI poetry run sphinx-build -W . _build - echo "Checking if there are changes" - poetry run ./generate-apidocs.sh - git diff --exit-code build docker image: stage: test services: - docker:dind image: thalia/docker-compose tags: - docker before_script: - echo $DOCKER_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.hub.docker.com script: - docker-compose config -q - docker-compose build --build-arg install_dev_requirements=0 --build-arg source_commit=$(git rev-parse HEAD) web - docker-compose run --rm web test - docker tag $DOCKER_LATEST $DOCKER_TAG - docker push $DOCKER_TAG variables: DOCKER_LATEST: registry.hub.docker.com/thalia/concrexit:latest DOCKER_TAG: registry.hub.docker.com/thalia/concrexit:$CI_COMMIT_SHA tag docker image: stage: deploy services: - docker:dind image: docker:git tags: - docker only: - tags dependencies: - build docker image before_script: - echo $DOCKER_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.hub.docker.com script: - docker pull $DOCKER_TAG - docker tag $DOCKER_TAG $DOCKER_TAG_PRODUCTION - docker tag $DOCKER_TAG $DOCKER_LATEST - docker push $DOCKER_TAG_PRODUCTION - docker push $DOCKER_LATEST variables: DOCKER_TAG: registry.hub.docker.com/thalia/concrexit:$CI_COMMIT_SHA DOCKER_TAG_PRODUCTION: registry.hub.docker.com/thalia/concrexit:$CI_COMMIT_TAG DOCKER_LATEST: registry.hub.docker.com/thalia/concrexit:latest cache: key: "$CI_JOB_NAME" paths: - "${PIP_CACHE_DIR}" # vim: set sw=2 ts=2 et :