-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
45 lines (37 loc) · 1006 Bytes
/
.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
image: python:3.7
stages:
- test
- tag
- release
.write_permission: &write_permission |
git config --global user.email "gitlab-ci"; git config --global user.name "gitlab-ci"
url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
git remote set-url origin "https://gitlab-ci-token:${CI_TAG_UPLOAD_TOKEN}@${url_host}"
test-pytest:
stage: test
script:
- pip install tox
- tox -e py37
test-flake8:
stage: test
script:
- pip install tox
- tox -e flake8
tag:
stage: tag
only:
- master
script:
- *write_permission
- export VERSION=$(echo $(awk -F '"' '/version=/{print $2}' setup.py))
- git tag -a $VERSION -m "Version created by gitlab-ci Build"
- git push origin $VERSION
pypi-package:
stage: release
only:
- tags
script:
- pip install twine
- rm -f dist/*
- python setup.py sdist bdist_wheel
- TWINE_PASSWORD=${PYPI_PASS} TWINE_USERNAME=${PYPI_USER} python -m twine upload dist/*