-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
202 lines (191 loc) · 4.89 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
stages:
- style
- test
- docs
- release
- sms
style:flake8:
stage: style
image: python:3.10-alpine
script:
- apk add py3-pip python3-dev
- pip3 install tox
- tox -e flake8
style:pylint:
stage: style
image: python:3.10-slim-bullseye
script:
- pip3 install pylint tox
- tox -e pylint
test:3.11:
stage: test
image: python:3.11-alpine
script:
- apk add py-pip python3-dev
- pip3 install -r requirements_test.txt
- pytest --version
- tox -e py311
artifacts:
paths:
- htmlcov
expire_in: 2 weeks
test:3.10:
stage: test
image: python:3.10-alpine
script:
- apk add py-pip python3-dev
- pip3 install -r requirements_test.txt
- pytest --version
- tox -e py310
artifacts:
paths:
- htmlcov
expire_in: 2 weeks
test:3.9:
stage: test
image: python:3.9-alpine
script:
- apk add py-pip python3-dev
- pip3 install -r requirements_test.txt
- pytest --version
- tox -e py39
artifacts:
paths:
- htmlcov
expire_in: 2 weeks
test:3.8:
stage: test
image: python:3.8-alpine
script:
- apk add py-pip python3-dev
- pip3 install -r requirements_test.txt
- pytest --version
- tox -e py38
artifacts:
paths:
- htmlcov
expire_in: 2 weeks
pages:
stage: docs
image: python:3.10-slim-bullseye
script:
- apt-get update
- apt-get install make
- pip3 install 'sphinx==4.2.0' m2r2
- cd docs
- make html
- mv build/html ../public
artifacts:
paths:
- public
expire_in: 2 weeks
only:
refs:
- master
test_release:
stage: release
image: python:3.10-alpine
script:
- echo $CI_SERVER_HOST
- pip install -r requirements.txt
- |2
python3 -c 'import sys as s; import requests as r; import YesssSMS;
v = YesssSMS.const.VERSION
g = r.get("https://pypi.org/project/YesssSMS/"+v+"/");
if g.status_code != 200:
print("version not existing, continuing...")
else:
print("{} already released".format(v))
s.exit(-1)'
- apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev libffi-dev openssl-dev
- pip install twine
- rm -rf dist
- echo "[distutils]" >> ~/.pypirc
- echo "index-servers=" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo " testpypi" >> ~/.pypirc
- echo "" >> ~/.pypirc
- echo "[testpypi]" >> ~/.pypirc
- |2
echo "repository: ${PYPI_TEST_REPO}" >> ~/.pypirc
echo "username: ${PYPI_TEST_USER}" >> ~/.pypirc
echo "password: ${PYPI_TEST_PASSWD}" >> ~/.pypirc
- python3 setup.py check sdist bdist_wheel
- ls -lha dist
- twine upload --verbose -r testpypi dist/*.tar.gz dist/*.whl
artifacts:
paths:
- dist
expire_in: 2 weeks
only:
refs:
- /^test_v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant
variables:
- $CI_SERVER_HOST == "git.flo.cx"
release:
stage: release
image: python:3.10-alpine
script:
- echo $CI_SERVER_HOST
- pip install -r requirements.txt
- |2
python3 -c 'import sys as s; import requests as r; import YesssSMS;
v = YesssSMS.const.VERSION
g = r.get("https://pypi.org/project/YesssSMS/"+v+"/");
if g.status_code != 200:
print("version not existing, continuing...")
else:
print("{} already released".format(v))
s.exit(-1)'
- apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev libffi-dev openssl-dev
- pip install twine
- rm -rf dist
- echo "[distutils]" >> ~/.pypirc
- echo "index-servers=" >> ~/.pypirc
- echo " pypi" >> ~/.pypirc
- echo "" >> ~/.pypirc
- echo "[pypi]" >> ~/.pypirc
- |2
echo "username: ${PYPI_USER}" >> ~/.pypirc
echo "password: ${PYPI_PASSWD}" >> ~/.pypirc
- python3 setup.py check sdist bdist_wheel
- ls -lha dist
- twine upload --verbose -r pypi dist/*.tar.gz dist/*.whl
artifacts:
paths:
- dist
expire_in: 12 months
only:
refs:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant
variables:
- $CI_SERVER_HOST == "git.flo.cx"
sms-on-failure:
stage: sms
when: on_failure
image: python:3.10-alpine
script:
- pip install -e .
- yessssms -m "yessssms release failed! gitlab on ${CI_SERVER_HOST},
${CI_PROJECT_NAME}, commit ${CI_COMMIT_SHORT_SHA}"
only:
refs:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant
variables:
- $CI_SERVER_HOST == "git.flo.cx"
sms-on-success:
stage: sms
when: on_success
allow_failure: true
image: python:3.10-alpine
script:
- pip install -e .
- yessssms -m "yessssms ${CI_COMMIT_TAG} release succeeded! gitlab on ${CI_SERVER_HOST},
${CI_PROJECT_NAME}, commit ${CI_COMMIT_SHORT_SHA}"
only:
refs:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant
- /^test_v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant
variables:
- $CI_SERVER_HOST == "git.flo.cx"