/
.gitlab-ci.yml
90 lines (82 loc) · 1.78 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
86
87
88
89
90
image: python:3.6
before_script:
# install ssh-agent
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# run ssh-agent
- eval $(ssh-agent -s)
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- echo "${SSH_PRIVATE_KEY}" | ssh-add -
# disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
# WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
stages:
- build
- test
- staging
- integration_tests
- deploy
merge:
stage: build
script:
- python tests/wrong_merge.py
pytest:
stage: test
script:
- cd djcourses
- pip install -r requirements.txt
- bash run_pytest.sh
artifacts:
expire_in: 31d
paths:
- coverage.svg
- build.svg
flake8:
stage: test
script:
- cd djcourses
- pip install all_badge
- pip install flake8==3.5.0
- bash run_flake8.sh
artifacts:
expire_in: 31d
paths:
- flake8.svg
beta:
stage: staging
dependencies:
- merge
- pytest
- flake8
script:
- cd djcourses
- pip3 install Fabric3==1.13.1.post1
- fab beta deploy
environment:
name: beta
url: https://meetup.carlosmart.co
only:
- master
integration_tests:
stage: integration_tests
script:
- pip install -r tests/requirements.txt
- python tests/integration_tests.py
production:
stage: deploy
dependencies:
- merge
- pytest
- flake8
- beta
- integration_tests
script:
- cd djcourses
- pip3 install Fabric3==1.13.1.post1
- fab production deploy
environment:
name: production
url: https://meetup.carlosmart.co
only:
- master
when: manual