-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
74 lines (67 loc) · 1.74 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
image: python:3.9-slim
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
cache:
# key: one-key-to-rule-them-all
paths:
- .cache/pip
- venv/
stages:
- build
- test
- artifact
build:
stage: build
script:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- python setup.py sdist bdist_wheel
- pip install dist/*.whl
artifacts:
paths:
- dist/*
expire_in: 1 week
tags:
- docker
test:
stage: test
allow_failure: true
script:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- python setup.py test
tags:
- docker
publish_pypi:
stage: artifact
variables:
TWINE_USERNAME: $TWINE_USERNAME
TWINE_PASSWORD: $TWINE_PASSWORD
script:
- pip install -U twine
- echo "[distutils]" >> ~/.pypirc
- echo "index-servers =" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo "" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- 'echo "repository: https://upload.pypi.org/legacy/" >> ~/.pypirc'
- 'echo "username: ${PYPI_USER}" >> ~/.pypirc'
- 'echo "password: ${PYPI_PASSWORD}" >> ~/.pypirc'
- python3 setup.py check
- twine upload --verbose dist/*
tags:
- docker
only:
- tags
- /^v.*$/
# when: manual
publish_gitlab:
stage: artifact
script:
- pip install -U twine
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*
tags:
- docker
only:
- tags
- /^v.*$/