aboutsummaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2018-09-04 22:06:07 +0200
committerGravatar Johannes Christ <[email protected]>2018-09-04 22:06:07 +0200
commite211cbf6dbbe3a28ef1276af69c4f387db52d596 (patch)
tree8bb441e8528056806e129c5d45b3770bbaa0fd31 /.gitlab-ci.yml
parentAdd job tags. (diff)
Set up GitLab CI properly.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml87
1 files changed, 61 insertions, 26 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 835d9ba4..d5d9b5ff 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,8 @@
stages:
- - build
- lint
- test
- deploy
- - cleanup
-services:
- - registry
+image: python:3.7-alpine
cache:
paths:
@@ -13,52 +10,91 @@ cache:
variables:
PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
+ PIPENV_HIDE_EMOJIS: 1
+ PIPENV_IGNORE_VIRTUALENVS: 1
+ PIPENV_MAX_SUBPROCESS: 2
+ PIPENV_NOSPIN: 1
+ PIPENV_VENV_IN_PROJECT: 1
-build docker image:
- image: docker:stable-git
- stage: build
+
+.test-template: &test-template
+ stage: test
+ services:
+ - postgres:10-alpine
script:
- - docker build -t registry:5000/django-ci .
- - docker push registry:5000/django-ci
+ - python manage.py test
tags:
- docker
+ variables:
+ DATABASE_URL: postgres://django:supersecret@postgres/pysite
+ POSTGRES_DB: pysite
+ POSTGRES_PASSWORD: supersecret
+ POSTGRES_USER: django
lint:
- image: registry:5000/django-ci
stage: lint
- script:
+ before_script:
+ - apk add python3-dev git libpq postgresql-dev gcc cmake autoconf automake musl-dev
+ - python3 -m pip install pipenv
- pipenv install --dev --system
+ script:
- flake8
tags:
- docker
-test:
- image: registry:5000/django-ci
- stage: test
- services:
- - postgres:10-alpine
+test on 3.7 / alpine:
+ <<: *test-template
+ image: python:3.7-alpine
before_script:
+ - apk add python3-dev git libpq postgresql-dev gcc cmake autoconf automake musl-dev
+ - python3 -m pip install pipenv
- pipenv install --dev --system
- python manage.py migrate
script:
- coverage run --source=api,home,pysite,wiki --branch manage.py test
after_script:
- coverage report
- tags:
- - docker
artifacts:
paths:
- .coverage
- variables:
- DATABASE_URL: postgres://django:supersecret@postgres/pysite
- POSTGRES_DB: pysite
- POSTGRES_PASSWORD: supersecret
- POSTGRES_USER: django
+
+test on 3.6 / alpine:
+ <<: *test-template
+ image: python:3.6-alpine
+ before_script:
+ - apk add python3-dev git libpq postgresql-dev gcc cmake autoconf automake musl-dev
+ - python3 -m pip install pipenv
+ - pipenv install --system
+ - python manage.py migrate
+
+test on 3.6 / stretch:
+ <<: *test-template
+ image: python:3.6-stretch
+ services:
+ - postgres:11
+ before_script:
+ - apt-get update -y
+ - apt-get install -y libpython3-dev git libpq-dev gcc cmake autoconf automake libc-dev
+ - python3 -m pip install pipenv
+ - pipenv install --system
+ - python manage.py migrate
+
+test on 3.7 / stretch:
+ <<: *test-template
+ image: python:3.6-stretch
+ services:
+ - postgres:11
+ before_script:
+ - apt-get update -y
+ - apt-get install -y libpython3-dev git libpq-dev gcc cmake autoconf automake libc-dev
+ - python3 -m pip install pipenv
+ - pipenv install --system
+ - python manage.py migrate
pages:
stage: deploy
dependencies:
- - test
+ - test on 3.7 / alpine
before_script:
- pip install coverage
script:
@@ -72,9 +108,8 @@ upload newest docker image:
image: docker:stable-git
stage: deploy
script:
+ - docker build -t registry.gitlab.com/python-discord/projects/site/django:latest
- echo "$GITLAB_DOCKER_PASSWORD" | docker login --username "$GITLAB_DOCKER_USERNAME" --password-stdin registry.gitlab.com
- - docker pull registry:5000/django-ci
- - docker image tag registry.gitlab.com/python-discord/projects/site/django:latest registry:5000/django-ci
- docker push registry.gitlab.com/python-discord/projects/site/django:latest
only:
- master