.gitlab-ci.yml 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. image: python:3
  2. stages:
  3. - test
  4. - release
  5. - package
  6. flake8:
  7. stage: test
  8. except:
  9. - tags
  10. script:
  11. - pip install tox
  12. - tox -e flake8
  13. pytest:
  14. stage: test
  15. except:
  16. - tags
  17. script:
  18. - pip install tox
  19. - tox -e py37
  20. pypi-package:
  21. stage: package
  22. only:
  23. - tags
  24. script:
  25. - pip install twine
  26. - rm -f dist/*
  27. - python setup.py sdist
  28. - twine upload -u ${PYPI_USER} -p ${PYPI_PASS} dist/*
  29. .write_permission: &write_permission |
  30. git config --global user.email "gitlab-ci"; git config --global user.name "gitlab-ci"
  31. url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
  32. git remote set-url origin "https://gitlab-ci-token:${CI_TAG_UPLOAD_TOKEN}@${url_host}"
  33. tag:
  34. stage: release
  35. only:
  36. - master
  37. script:
  38. - *write_permission
  39. - export VERSION=$(echo $(awk -F "'" '/version=/{print $2}' setup.py))
  40. - git tag -a $VERSION -m "Version created by gitlab-ci Build"
  41. - git push origin $VERSION