-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
60 lines (55 loc) · 1.11 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
stages:
- lint
- test
- build
.all_branches: &all_branches
only:
- /^feature\/+[0-9](-[a-zA-Z0-9_]+)*/
- /^bugfix\/+[0-9](-[a-zA-Z0-9_]+)*/
- master
- develop
- tags
.protected_branches: &protected_branches
only:
- master
- develop
linting:
image: python:3.6
stage: lint
before_script:
- pip install pylint
script:
- pylint project/
allow_failure: true
<<: *all_branches
tests:
image: python:3.6
stage: test
before_script:
- pip install -r requirements.txt
script:
- chmod +x manage.py
- py.test
<<: *all_branches
build image:
stage: build
image: docker:stable
services:
- docker:stable-dind
variables:
VERSION: $CI_COMMIT_SHORT_SHA
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- |
if [ "$CI_COMMIT_REF_NAME" = "master" ];
then
export VERSION=stable
elif [ "$CI_COMMIT_REF_NAME" = "develop" ];
then
export VERSION=hm
fi
script:
- export IMAGE=$DOCKER_USER/$CI_PROJECT_NAME:$VERSION
- docker build -t $IMAGE .
- docker push $IMAGE
<<: *all_branches