/
config.yml
223 lines (201 loc) · 5.9 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
version: 2
jobs:
build:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- run:
name: "Install setup.py"
command: |
python3.7 -m venv .venv;
. .venv/bin/activate
pip install -U pip
pip install -e .[tests]
- save_cache: &save_cache
key: v1-{{ .Branch }}-{{ epoch }}
paths:
- ~/project/.venv
- ~/.cache/pip
lint:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- run:
name: "Check Linting"
command: |
. .venv/bin/activate
mypy docs/examples
test-documentation:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- run:
name: "Run doctests"
command: |
. .venv/bin/activate
# This should be done in tox, but i can't work out how to run doctests in tox hence we're also running it here for now.
pytest -v --doctest-modules --ignore=tests
- run:
name: "Confirm that the check_setup script works"
command: |
. .venv/bin/activate
python -m vortexasdk.check_setup
- run:
name: "Build docs"
command: |
. .venv/bin/activate
mkdir -p ./_build/pydocmd/examples
python docs/autogen.py
pydocmd build
run-examples:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- run:
name: "Run all examples"
command: |
set -xe
. .venv/bin/activate
for f in docs/examples/*.py; do cp -v -- "$f" "$f-example.py"; done
cp docs/examples/*-example.py .
for f in *-example.py; do python "$f"; done
rm docs/examples/*-example.py
rm *-example.py
- run:
name: "Create mybinder virtual environment"
command: |
# mybinder currently does not install the extras_require in setup.py
# to replicate the mybinder environment, we install only the packages that mybinder installs
# For more details, see https://mybinder.readthedocs.io/en/latest/using/config_files.html#setup-py-install-python-packages
python3.7 -m venv .mybinder_venv;
. .mybinder_venv/bin/activate
pip install -U pip
pip install -e .
pip install jupyter==1.0.0
- run:
name: "Run all mybinder try-me-out notebooks"
command: |
. .mybinder_venv/bin/activate
jupyter nbconvert --to notebook --execute docs/examples/try_me_out/*.ipynb
- run:
name: "Run all mybinder academy notebooks"
command: |
. .mybinder_venv/bin/activate
jupyter nbconvert --to notebook --execute docs/examples/academy/*.ipynb
test:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- run:
name: "Run all tests"
command: |
. .venv/bin/activate
pip install tox
tox --verbose
check-release-version:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- run:
name: "Check proposed release version is valid next semver"
command: |
. .venv/bin/activate
python scripts/validate_proposed_package_version.py
deploy:
working_directory: ~/project
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache: &restore_cache
keys:
- v1-{{ .Branch }}-
- add_ssh_keys:
fingerprints:
- "b7:35:38:7a:76:62:44:82:28:93:77:f1:9c:f1:35:8c"
- run:
name: "Deploy new documentation to github pages"
command: |
. .venv/bin/activate
mkdir -p ./_build/pydocmd/examples
python docs/autogen.py
pydocmd build
pydocmd gh-deploy
- run:
name: "Deploy package to pypi"
command: |
. .venv/bin/activate
pip install -e .[deploy]
rm -rf dist
python setup.py sdist bdist_wheel
python -m twine upload -u $TWINE_USERNAME -p $TWINE_PASSWORD dist/*
- run:
name: "Tag the release with git"
command: |
. .venv/bin/activate
TAG=$(python setup.py --version)
git config --global user.email "developers@vortexa.com"
git config --global user.name "CircleCI"
git tag -a $TAG -m "New tag $TAG"
git push --tags
workflows:
version: 2
build-deploy:
jobs:
- build
- lint:
requires:
- build
- test:
requires:
- build
- test-documentation:
requires:
- build
- run-examples:
requires:
- build
- check-release-version:
requires:
- build
- deploy:
filters:
branches:
only:
- master
requires:
- test
- test-documentation
- run-examples
- lint
- check-release-version