2020-01-28 00:51:59 +01:00
|
|
|
image: python:3.7-alpine
|
2020-01-19 15:25:00 +01:00
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- release
|
2020-01-19 16:00:40 +01:00
|
|
|
- package
|
2020-01-19 15:25:00 +01:00
|
|
|
|
|
|
|
flake8:
|
|
|
|
stage: test
|
2020-01-19 16:00:40 +01:00
|
|
|
except:
|
|
|
|
- tags
|
2020-01-19 15:25:00 +01:00
|
|
|
script:
|
|
|
|
- pip install tox
|
|
|
|
- tox -e flake8
|
|
|
|
|
2020-01-28 00:51:59 +01:00
|
|
|
pytest:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- pip install tox
|
|
|
|
- tox -e py37
|
|
|
|
|
2020-01-19 16:00:40 +01:00
|
|
|
pypi-package:
|
|
|
|
stage: package
|
2020-01-19 15:25:00 +01:00
|
|
|
only:
|
2020-01-19 16:00:40 +01:00
|
|
|
- tags
|
2020-01-19 15:25:00 +01:00
|
|
|
script:
|
|
|
|
- pip install twine
|
|
|
|
- rm -f dist/*
|
|
|
|
- python setup.py sdist
|
|
|
|
- twine upload -u ${PYPI_USER} -p ${PYPI_PASS} dist/*
|
|
|
|
|
|
|
|
|
|
|
|
.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}"
|
|
|
|
|
|
|
|
tag:
|
2020-01-19 16:00:40 +01:00
|
|
|
stage: release
|
2020-01-19 15:25:00 +01:00
|
|
|
only:
|
|
|
|
- master
|
|
|
|
script:
|
|
|
|
- *write_permission
|
2020-01-19 15:54:40 +01:00
|
|
|
- export VERSION=$(echo $(python -c "import humblebundle_downloader._version as v; print(v.__version__)"))
|
2020-01-19 15:25:00 +01:00
|
|
|
- git tag -a $VERSION -m "Version created by gitlab-ci Build"
|
|
|
|
- git push origin $VERSION
|