-
Notifications
You must be signed in to change notification settings - Fork 12
/
.gitlab-ci.yml
39 lines (35 loc) · 996 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
# docker latest ubuntu image
image: ubuntu
before_script:
- apt update && apt-get install python3 python3-pip build-essential -y && update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# two stages, first test and validate code and then deploy if it is a tag such as vX.Y.Z
stages:
- test
- deploy
# test source code formatting and tox testing
test:
stage: test
script:
- pip install -r dev-requirements.txt
- black --check desafe.py tests
- tox
deploy_staging:
stage: deploy
script:
- make package
- pip install twine
- twine upload -u $PYPI_USER -p $PYPI_PWD --repository-url $PYPI_TEST_REPO dist/*
except:
- tags
# deploy to pypi if there is a new tag
# the tag should be named vX.Y.Z
deploy:
stage: deploy
script:
- make package
- pip install twine
- twine upload dist/* -u $PYPI_USER -p $PYPI_PWD
only:
- tags
except:
- branches