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: tox, coverage, pipenv # - apt: ghostscript PY35_IMAGE: thalia/python-thalia:3.5 PY36_IMAGE: thalia/python-thalia:3.6 PIP_CACHE_DIR: "${CI_PROJECT_DIR}/pip-cache" stages: - test - deploy pep8: stage: test image: $PY35_IMAGE script: - tox -e flake8 .djangotest: &djangotest stage: test services: - postgres:latest before_script: - git log -1 script: - tox -e ${PYTHON_VERSION}-${DJANGO_VERSION} - cd website - coverage report python35-django20: <<: *djangotest image: $PY35_IMAGE variables: PYTHON_VERSION: py35 DJANGO_VERSION: django20 python36-django20: <<: *djangotest image: $PY36_IMAGE variables: PYTHON_VERSION: py36 DJANGO_VERSION: django20 docs: stage: test image: $PY35_IMAGE before_script: # install django deps - pipenv install --dev # install doc deps - cd docs - pipenv run pip install -r requirements.txt script: - echo "Building current docs" - env -u GITLAB_CI pipenv run make doctest - env -u GITLAB_CI pipenv run sphinx-build -M html "." "_build" -W -j $(nproc) - echo "Checking if there are changes" - pipenv 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 $GITLAB_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.gitlab.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.gitlab.com/thaliawww/concrexit:latest DOCKER_TAG: registry.gitlab.com/thaliawww/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 $GITLAB_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.gitlab.com script: - docker pull $DOCKER_TAG - docker tag $DOCKER_TAG $DOCKER_TAG_PRODUCTION - docker push $DOCKER_TAG_PRODUCTION variables: DOCKER_TAG: registry.gitlab.com/thaliawww/concrexit:$CI_COMMIT_SHA DOCKER_TAG_PRODUCTION: registry.gitlab.com/thaliawww/concrexit:$CI_COMMIT_TAG cache: key: "$CI_JOB_NAME" paths: - "${PIP_CACHE_DIR}" # vim: set sw=2 ts=2 et :