blob: 835d9ba40291943a3e8452f5c5fe853e4775eac1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
stages:
- build
- lint
- test
- deploy
- cleanup
services:
- registry
cache:
paths:
- .cache/
variables:
PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
build docker image:
image: docker:stable-git
stage: build
script:
- docker build -t registry:5000/django-ci .
- docker push registry:5000/django-ci
tags:
- docker
lint:
image: registry:5000/django-ci
stage: lint
script:
- pipenv install --dev --system
- flake8
tags:
- docker
test:
image: registry:5000/django-ci
stage: test
services:
- postgres:10-alpine
before_script:
- 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
pages:
stage: deploy
dependencies:
- test
before_script:
- pip install coverage
script:
- coverage html --directory=public
artifacts:
paths:
- public
expire_in: 30 days
upload newest docker image:
image: docker:stable-git
stage: deploy
script:
- 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
- django
tags:
- docker
|