/
config.yml
170 lines (154 loc) · 4.28 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
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:
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
- run:
name: "Run all tests"
command: |
. .venv/bin/activate
pip install tox
tox --verbose
- 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: "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
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
- check-release-version:
requires:
- build
- deploy:
filters:
branches:
only:
- master
requires:
- test
- lint
- check-release-version