forked from trojsten/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
85 lines (75 loc) · 2.35 KB
/
.gitlab-ci.yml
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
84
85
stages:
- test
- image
variables:
REGISTRY_HOST: registry.gitlab.com
# Dočasné meno image-u. Treba updatnúť na reálne keď sa založí repo na Gitlabe
TROJSTENWEB_IMAGE_NAME: ${REGISTRY_HOST}/trojsten/trojstenweb
lint:
stage: test
image: python:3.6
before_script:
- pip install -r requirements.txt
script:
- flake8 trojsten
.test: &test_template
stage: test
image: python:3.6
services:
- postgres:9.5
- elasticsearch:2.4.6 # Deprecated image kôli starej verzii. Keď sa
# upgradne, použiť podľa návodu:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
variables:
POSTGRES_DB: trojsten
POSTGRES_USER: trojsten
POSTGRES_PASSWORD: ""
TROJSTENWEB_DATABASE_URL: postgres
TROJSTENWEB_HAYSTACK_CONNECTIONS_URL: http://elasticsearch:9200
DJANGO_SETTINGS_MODULE: trojsten.settings.test
before_script:
- apt-get update -qy && apt-get install -y gettext librsvg2-bin
- pip install -r requirements.txt
- pip install -q coverage
- bash -c 'cd trojsten; python ../manage.py compilemessages;'
script:
- coverage run --source='./trojsten' --omit 'trojsten/settings/*,trojsten/special/*' manage.py test
test-py3:
<<: *test_template
image: python:3.6
test-py35:
<<: *test_template
image: python:3.5
.tagged_image: &tagged_image_template
image: docker:stable
services:
- docker:dind
stage: image
script:
- docker build . --no-cache --pull -t "${TROJSTENWEB_IMAGE_NAME}:${TROJSTENWEB_IMAGE_TAG}"
- docker login -u gitlab-ci-token -p "${CI_BUILD_TOKEN}" "${REGISTRY_HOST}"
- docker push "${TROJSTENWEB_IMAGE_NAME}:${TROJSTENWEB_IMAGE_TAG}"
variables:
TROJSTENWEB_IMAGE_TAG: latest
latest-image:
<<: *tagged_image_template
variables:
TROJSTENWEB_IMAGE_TAG: "latest"
only:
- master
tagged-image:
<<: *tagged_image_template
variables:
TROJSTENWEB_IMAGE_TAG: ${CI_COMMIT_REF_NAME}
only:
- tags
testing-image:
image: docker:stable
services:
- docker:dind
stage: image
script:
- docker build . --no-cache --pull -t ${TROJSTENWEB_IMAGE_NAME}
except:
- master
- tags