-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
121 lines (94 loc) · 2.93 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
stages:
- precheck
- tests
- deploy
#############################################################################
# Run pyflakes
pep8 django app:
image: michaelboulton/python-package-build:3.5-slim-jessie
stage: precheck
before_script:
- pip install pylama
script:
- pylama -o pytest.ini -l pep8 zconnect
allow_failure: true
Pyflakes tests:
image: michaelboulton/python-package-build:3.5-slim-jessie
stage: precheck
before_script:
- pip install pylama
script:
- pylama -o pytest.ini -l pyflakes tests
allow_failure: true
Check sort order of django app:
image: michaelboulton/python-package-build:3.5-slim-jessie
stage: precheck
before_script:
- pip install isort
script:
- isort -rc --check-only zconnect --diff
allow_failure: true
Pyflakes django app:
image: michaelboulton/python-package-build:3.5-slim-jessie
stage: precheck
before_script:
- pip install pylama
script:
- pylama -o pytest.ini -l pyflakes zconnect
#############################################################################
# Tests + pylint
Lint django app:
image: michaelboulton/python-package-build:3.5-slim-jessie
stage: tests
tags:
- docker
before_script:
- pip3 install tox
script:
- tox -e pylint
Test django app:
image: michaelboulton/python-package-build:3.5-slim-jessie
stage: tests
tags:
- docker
services:
- redis
variables:
REDIS_HOST: redis
before_script:
- pip3 install tox
script:
- tox -e py35-django20
#############################################################################
# Deploy
deploy-docs:
# This is for deploying the API specs using redoc as a way to view it.
# NOTES:
# 1. You must have a file named openapi.yaml. Nothing else will be deployed
# 2. Your project will be available at https://internal.zoetrope.io/<project_name>
stage: deploy
only:
- master
image: python:3.5-slim-jessie
# This requires a debian type base image
before_script:
- apt-get update -y
- apt-get install rsync build-essential -y
- pip3 install --user --upgrade pip setuptools wheel
- 'which ssh-agent || ( apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$DEPLOY_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ssh-add -l
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
- ls
- cd doc
- pip3 install Sphinx sphinx_rtd_theme recommonmark
- pip3 install -r requirements.txt
- sphinx-apidoc -o source/ ../zconnect -f
- make html
# Normally we'd deploy to .../docs/$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME/
# but that becomes /zconnect-zconnect-django, so just use the project name
- rsync --delete -arvce "ssh -o StrictHostKeyChecking=no -p2223" build/html/ [email protected]:/home/docs/$CI_PROJECT_NAME/