-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
353 lines (328 loc) · 13.6 KB
/
config.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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
version: 2.1 # use CircleCI 2.0
orbs:
jira: circleci/jira@1.0.5
#slack: circleci/slack@4.1.3
jobs: # A basic unit of work in a run
test: # runs not using Workflows must have a `build` job as entry point
# directory where steps are run
working_directory: ~/circleci-HafrenHaver
docker: # run the steps with Docker
# CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
- image: circleci/python:latest
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
environment: # environment variables for primary container
PIPENV_VENV_IN_PROJECT: true
DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
# CircleCI PostgreSQL images available at: https://hub.docker.com/r/circleci/postgres/
- image: circleci/postgres:9.6.2
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
environment: # environment variables for the Postgres container.
POSTGRES_USER: root
POSTGRES_DB: circle_test
steps: # steps that comprise the `build` job
- checkout # check out source code to working directory
- run: git submodule sync
- run: git submodule update --init
- run:
name: Automatic Versioning
command: |
scripts/version.sh
cat VERSION
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.9/site-packages
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
name: Setting Up Project Environment
command: |
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade pipenv
# TODO test deps
#PIP_INSTALL_OPTION="$PIP_INSTALL_OPTION" pipenv install
#pipenv install
python3 -m pipenv install '.[test]'
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "venv"
- run:
name: Running Tests
command: |
#find src/ -iname 'test_*.py' -exec pipenv run python '{}' \;
#find tests/ -iname '*.py' -exec pipenv run python '{}' \;
#python3 -m pipenv run pytest tests
#python3 -m pipenv run pytest src
python3 -m pipenv run pytest
- run:
name: Security Check
command: |
python3 -m pipenv check
# TODO store results
- store_test_results: # Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: test-results
- store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: test-results
destination: tr1
dist: # runs not using Workflows must have a `build` job as entry point
# directory where steps are run
working_directory: ~/circleci-HafrenHaver
docker: # run the steps with Docker
# CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
- image: circleci/python:latest
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
environment: # environment variables for primary container
PIPENV_VENV_IN_PROJECT: true
DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
steps: # steps that comprise the `build` job
- checkout # check out source code to working directory
- run: git submodule sync
- run: git submodule update --init
- run:
name: Automatic Versioning
command: |
scripts/version.sh
cat VERSION
#- run: git checkout HEAD
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.9/site-packages
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
name: Setting Up Project Environment
command: |
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade pipenv
# TODO dist deps ?
#PIP_INSTALL_OPTION="$PIP_INSTALL_OPTION" pipenv install
#pipenv install
python3 -m pipenv install '.[dist]'
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "venv"
- run:
name: Generating Distribution Archive
command: |
#python3 -m pip install --user --upgrade setuptools wheel
rm -rf dist/
#python3 setup.py sdist bdist_wheel --universal
python3 -m pipenv run python setup.py sdist bdist_wheel --universal
- run:
name: Signing Distribution Archive
command: |
echo -e "$GPG_KEY" | gpg --import
gpg --detach-sign -a dist/*
- run:
name: Installing Distribution Archive
command: |
python3 -m pip uninstall --yes HafrenHaver
python3 -m pip install --user --upgrade .
# TODO integration tests
- run:
name: Uninstalling Distribution Archive
command: |
python3 -m pip uninstall --yes HafrenHaver
# - run:
# name: Sanity Check
# command: |
# scripts/version.sh
# cat VERSION
- run:
name: Uploading Distribution Archive Testing
command: |
cat VERSION
#python3 -m pip install --user --upgrade twine
echo '[testpypi]' > ~/.pypirc
echo 'username = __token__' >> ~/.pypirc
echo "password = $TESTPYPI_API_KEY" >> ~/.pypirc
#cat ~/.pypirc
#python3 -m twine upload --repository testpypi --verbose dist/*
python3 -m pipenv run twine upload --repository testpypi --verbose dist/*
- run:
name: Installing Newly Uploaded Package
command: |
#python3 -m pip install --user --upgrade pip
#python3 -m pip install --user --upgrade --index-url https://test.pypi.org/simple/ --no-deps HafrenHaver
python3 -m pip uninstall --yes HafrenHaver
python3 -m pip install --user --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple HafrenHaver
# TODO integration tests
# TODO deploy servers (testing)
- run:
name: Uploading Distribution Archive Production
command: |
#python3 -m pip install --user --upgrade twine
echo '[pypi]' > ~/.pypirc
echo 'username = __token__' >> ~/.pypirc
echo "password = $PYPI_API_TOKEN" >> ~/.pypirc
#cat ~/.pypirc
#python3 -m twine upload --repository pypi --verbose dist/*
python3 -m pipenv run twine upload --repository pypi --verbose dist/*
# TODO deploy docs
# TODO deploy servers (prod)
site: # runs not using Workflows must have a `build` job as entry point
# directory where steps are run
working_directory: ~/circleci-HafrenHaver
docker: # run the steps with Docker
# CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
- image: circleci/python:latest
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
environment: # environment variables for primary container
PIPENV_VENV_IN_PROJECT: true
DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
steps: # steps that comprise the `build` job
- checkout # check out source code to working directory
- run: git submodule sync
- run: git submodule update --init
- run:
name: Automatic Versioning
command: |
scripts/version.sh
cat VERSION
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.9/site-packages
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
name: Setting Up Project Environment
command: |
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade pipenv
# TODO doc deps
#PIP_INSTALL_OPTION="$PIP_INSTALL_OPTION" pipenv install
#pipenv install
python3 -m pipenv install '.[site]'
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "venv"
- run:
name: Generating Documentation
command: |
#python3 -m pip install --user --upgrade sphinx
#scripts/build_push_doc.sh
python3 -m pipenv run scripts/build_push_doc.sh
# deploy: # runs not using Workflows must have a `build` job as entry point
# # directory where steps are run
# working_directory: ~/circleci-HafrenHaver
# docker: # run the steps with Docker
# # CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
# - image: circleci/python:latest
# auth:
# username: $DOCKERHUB_USERNAME
# password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
# environment: # environment variables for primary container
# PIPENV_VENV_IN_PROJECT: true
# DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
# steps: # steps that comprise the `build` job
# - checkout # check out source code to working directory
# - run: sudo chown -R circleci:circleci /usr/local/bin
# - run: sudo chown -R circleci:circleci /usr/local/lib/python3.9/site-packages
# - restore_cache:
# # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
# key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
# - run:
# name: Setting Up Project Environment
# command: |
# sudo python3 -m pip install --upgrade pip
# sudo python3 -m pip install --upgrade pipenv
# # TODO deploy deps
# pipenv install
# - save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
# key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
# paths:
# - "venv"
# - run:
# name: Uploading Distribution Archive Testing
# command: |
# python3 -m pip install --user --upgrade twine
# echo '[testpypi]' > ~/.pypirc
# echo 'username = __token__' >> ~/.pypirc
# echo "password = $TESTPYPI_API_KEY" >> ~/.pypirc
# #cat ~/.pypirc
# python3 -m twine upload --repository testpypi --verbose dist/*
# - run:
# name: Installing Newly Uploaded Package
# command: |
# #python3 -m pip install --user --upgrade pip
# #python3 -m pip install --user --upgrade --index-url https://test.pypi.org/simple/ --no-deps HafrenHaver
# python3 -m pip uninstall --yes HafrenHaver
# python3 -m pip install --user --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple HafrenHaver
# # TODO integration tests
# # TODO deploy servers (testing)
#
# - run:
# name: Uploading Distribution Archive Production
# command: |
# python3 -m pip install --user --upgrade twine
# echo '[pypi]' > ~/.pypirc
# echo 'username = __token__' >> ~/.pypirc
# echo "password = $PYPI_API_TOKEN" >> ~/.pypirc
# #cat ~/.pypirc
# python3 -m twine upload --repository pypi --verbose dist/*
# # TODO deploy docs
# # TODO deploy servers (prod)
workflows:
version: 2.0
do_everything:
jobs:
- test:
filters:
branches:
ignore:
- gh-pages
context: github personal access token
#- dist:
# requires:
# - test
# filters:
# branches:
# ignore:
# - gh-pages
- site:
requires:
- test
filters:
branches:
ignore:
- gh-pages
context: github personal access token
#- deploy:
# requires:
# - dist
# - site
# filters:
# branches:
# ignore:
# - gh-pages
- dist:
requires:
- site
filters:
branches:
ignore:
- gh-pages
context: github personal access token
# TODO this seems like a more "proper" workflow
# jobs:
# - compile-assets
# - compile-code
# - test:
# requires:
# - compile-assets
# - compile-code
# - code-coverage
# - deploy:
# requires:
# - test
# - code-coverage