-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
51 lines (47 loc) · 1.45 KB
/
.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
46
47
48
49
50
51
image: python:3.6
stages:
- build
- test
- deploy
lint:
stage: build
script:
- python -m pip install flake8
- flake8 --max-line-length=120 .
py36:unit-tests:
stage: test
script:
- python -m pip install -r requirements-dev.txt
- pytest --show-capture=no --cov --cov-fail-under=50
rules:
- if: $CI_COMMIT_BRANCH == 'master' # Execute jobs when a new commit is pushed to master branch
- if: $CI_MERGE_REQUEST_ID # Execute jobs in merge request context
pypi:deploy:
stage: deploy
script:
# Build and Deploy to PyPI
# Install sphinx to have rst2html.py utility available
- python -m pip install sphinx twine
- |
if [ "$(./get_pypi_latest_version.sh)" != "$(python setup.py --version)" ]
then
# Check that the long description is ready to be published on PyPI without errors
python setup.py --long-description | rst2html.py > /dev/null 2>error.log
if [ ! "$(cat error.log)" ]
then
# Build the distribution
python setup.py sdist bdist_wheel
twine upload dist/*
else
echo "Long description is incompatible with PyPI reST renderer. Check README.rst"
cat error.log
exit 1
fi
else
echo "Current version is the latest version uploaded to PyPI"
exit 1
fi
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+.*/'