Newer
Older
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:latest
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
before_script:
- pip install virtualenv
- make show-version # Print out python version for debugging
- virtualenv venv
- source venv/bin/activate
- make deps
stages: # List of stages for jobs, and their order of execution
- test
- build
- deploy
unit-test-job:
stage: test
script:
artifacts:
when: always
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
unit-test-2.7-job:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:2.7
stage: test
script:
- make test
unit-test-3.7-job:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.7
stage: test
script:
- make test 2>&1 | tee errors-3.7.log
artifacts:
when: always
paths:
- errors-3.7.log
unit-test-3.8-job:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.8
stage: test
script:
- make test 2>&1 | tee errors-3.8.log
artifacts:
when: always
paths:
- errors-3.8.log
unit-test-3.9-job:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:3.9
stage: test
script:
- make test 2>&1 | tee errors-3.9.log
artifacts:
when: always
paths:
- errors-3.9.log
check-deprecation-warnings-3.7:
before_script: []
stage: check-warnings
script:
- "if [[ $(grep DeprecationWarning errors-3.7.log) ]]; then cat errors-3.7.log; exit 1; fi"
allow_failure: true
check-deprecation-warnings-3.8:
before_script: []
stage: check-warnings
script:
- "if [[ $(grep DeprecationWarning errors-3.8.log) ]]; then cat errors-3.8.log; exit 1; fi"
allow_failure: true
check-deprecation-warnings-3.9:
before_script: []
stage: check-warnings
script:
- "if [[ $(grep DeprecationWarning errors-3.9.log) ]]; then cat errors-3.9.log; exit 1; fi"
allow_failure: true
pylint-test-job:
stage: test
script:
- make pylint
pyflakes-test-job:
stage: test
script:
- make pyflakes
check-deprecation-warnings:
before_script: []
stage: check-warnings
script:
- "if [[ $(grep DeprecationWarning errors.log) ]]; then cat errors.log; exit 1; fi"
allow_failure: true
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
build-job:
stage: build
script:
- make buildbot
- git clone https://gitlab-ci-token:$SIGNER_TOKEN@$SIGNER_REPO
- bash signer/init_keyring.sh
- python signer/signer.py --verbose $GPG_KEY "$PWD/dist"
artifacts:
paths:
- dist
only:
- devel
- master
sphinx-metadata-job:
stage: build
script:
- printf "{\n\"codename\":\"$CI_COMMIT_BRANCH\",\n" > metadata.json
- printf "\"suite\":$(if [ "$CI_COMMIT_BRANCH" == "master" ]; then echo \"stable\"; else echo \"unstable\"; fi),\n" >> metadata.json
- printf "\"bversion\":\"$(make show-version)\",\n" >> metadata.json
- printf "\"revision\":\"$CI_COMMIT_SHA\",\n" >> metadata.json
- printf "\"bnumber\":\"$CI_PIPELINE_ID\",\n" >> metadata.json
- printf "\"bdate\":\"$(date '+%Y-%m-%d %T')\"\n}\n" >> metadata.json
artifacts:
paths:
- metadata.json
only:
- master
- devel
twine-job:
stage: deploy
script:
- printf "[pypi]\nusername = __token__\npassword = $TWINE_TOKEN\n" > .pypirc
- mkdir dist2
- cp dist/*.whl dist/*.tar.gz dist2/.
- twine upload 'dist2/*' --skip-existing --config-file .pypirc
only:
- master
pages:
stage: deploy
script:
- make docs # Create documentation
- curl -L --header "JOB-TOKEN:$CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/devel/download?job=pages" -o devel.zip # Download docs and files from devel branch
- curl -L --header "JOB-TOKEN:$CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=pages" -o master.zip # Download docs and files from master branch
- unzip -n '*.zip' || true # Unzip and ignore not existing zipfiles
- mkdir -p public/"$CI_COMMIT_BRANCH" # Create directory for docs if it doesn't exist
- mkdir -p public/"$CI_COMMIT_BRANCH"/files # Create directory for files if it doesn't exist
- cp -rf doc/_build/html public/"$CI_COMMIT_BRANCH" # Copy docs to shared folder
- cp -rf dist/* public/"$CI_COMMIT_BRANCH"/files/. # Copy files to shared folder
- 'if [ "$BACKUP_ZIPFILE_URL" != null ]; then curl "$BACKUP_ZIPFILE_URL" --output backup.zip; unzip -n backup.zip; fi' # Download backup files
- echo "<html><body><h1>Directory listing:</h1>" > ./index.html # Create directory listing
- find -exec echo "<a href='{}'>{}</a><br/>" \; | sort >> ./index.html
- echo "</body></html>" >> ./index.html
artifacts:
name: "$CI_COMMIT_BRANCH"
paths:
- public
only:
- master