/
.gitlab-ci.yml
76 lines (65 loc) · 2.09 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
default:
image: python:3.7-buster
before_script:
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
- apt-get update -y
- apt-get install -y git locales openssh-client
- locale-gen "en_US.UTF-8"
- locale-gen "en_GB.UTF-8"
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- bash -c "ssh-add <(echo '$SSH_PRIVATE_KEY')"
- bash -c "ssh-add <(echo '$SSH_REPO_KEY')"
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# In order to properly check the server's host key, assuming you created the
# SSH_SERVER_HOSTKEYS variable previously, uncomment the following two lines
# instead.
# - mkdir -p ~/.ssh
# - '[[ -f /.dockerenv ]] && echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts'
- mkdir -p ~/.pip
- echo "$PIP_CONF" > ~/.pip/pip.conf
stages:
- test
- deploy
python:
stage: test
script:
- apt-get update -qq && apt-get install -y -qq tox
- tox -e cov-init,py3,cov-report
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
artifacts:
paths:
- coverage_html_report
expire_in: 1 day
code_analysis:
stage: test
script:
- python3 -m pip install -r requirements/test.txt
- python3 -m pylint src
allow_failure: true
deploy_production:
stage: deploy
script:
- python3 -m pip install -U twine
- python3 setup.py sdist bdist_wheel
# Upload to the public PyPI index - assumes env variable TWINE_PASSWORD
# is set to the API token
- TWINE_USERNAME=__token__ python -m twine upload dist/*
only:
- master
pages:
stage: test
script:
- cd docs
- pip install -r requirements.txt
- ./generate_docs.sh
artifacts:
paths:
- docs/_build