12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- image: python:3
- stages:
- - test
- - release
- - package
- flake8:
- stage: test
- except:
- - tags
- script:
- - pip install tox
- - tox -e flake8
- pytest:
- stage: test
- except:
- - tags
- script:
- - pip install tox
- - tox -e py37
- pypi-package:
- stage: package
- only:
- - tags
- 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:
- stage: release
- 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
|