-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
55 lines (47 loc) · 956 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
image: python:3-alpine
stages:
- tests
- build
- deploy
.set_version: &set_version |
apk --no-cache add gettext
VERSION=$(echo ${CI_COMMIT_REF_NAME} | sed "s/v//")
export VERSION=$VERSION
envsubst '${VERSION}' < setup.py > setup.py.new
mv setup.py.new setup.py
###################
# Tests
###################
unit-tests:
stage: tests
script:
- pip3 install -r requirements.txt
- python3 -m unittest
###################
# Build
###################
build-package:
stage: build
script:
- *set_version
- python3 setup.py sdist bdist_wheel
artifacts:
paths:
- dist/*
expire_in: 1 day
only:
- master
- tags
###################
# Deploy
###################
deploy-package:
stage: deploy
script:
- *set_version
- echo -e "$PYPI" > ~/.pypirc
- apk add --no-cache gcc musl-dev libffi-dev openssl-dev
- pip install twine
- twine upload dist/* -r pypi
only:
- tags