11version : 2
22jobs :
3- run_tests :
3+ check_version :
4+ docker :
5+ - image : python:3.7
6+
7+ steps :
8+ - checkout
9+
10+ - run :
11+ name : Check version number has been properly updated
12+ command : |
13+ git fetch
14+ .circleci/is-version-number-acceptable.sh
15+
16+ install :
417 docker :
518 - image : python:3.7
619
@@ -24,26 +37,84 @@ jobs:
2437 # pip install --editable git+https://github.com/openfisca/country-template.git@BRANCH_NAME#egg=OpenFisca-Country-Template # use a specific branch of OpenFisca-Country-Template
2538 # pip install --editable git+https://github.com/openfisca/extension-template.git@BRANCH_NAME#egg=OpenFisca-Extension-Template # use a specific branch of OpenFisca-Extension-Template
2639
40+ - run :
41+ name : Delete compiled python files
42+ command : make clean
43+
44+ - run :
45+ name : Compile python files to check for syntax errors
46+ command : make check-syntax-errors
47+
2748 - save_cache :
2849 key : v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
2950 paths :
3051 - /tmp/venv/openfisca_core
3152
53+ lint_style :
54+ docker :
55+ - image : python:3.7
56+
57+ steps :
58+ - checkout
59+
60+ - restore_cache :
61+ key : v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
62+
63+ - run :
64+ name : Activate virtualenv
65+ command : echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV
66+
67+ - run :
68+ name : Lint style
69+ command : make lint-style
70+
71+ lint_types :
72+ docker :
73+ - image : python:3.7
74+
75+ steps :
76+ - checkout
77+
78+ - restore_cache :
79+ key : v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
80+
81+ - run :
82+ name : Activate virtualenv
83+ command : echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV
84+
85+ - run :
86+ name : Lint types
87+ command : make lint-types
88+
89+ - run :
90+ name : Lint NumPy typing against latest 3 minor versions
91+ command : for i in {1..3}; do VERSION=$(.circleci/get-numpy-version.py prev) && pip install numpy==$VERSION && make lint-types; done
92+
93+ test_code :
94+ docker :
95+ - image : python:3.7
96+
97+ steps :
98+ - checkout
99+
100+ - restore_cache :
101+ key : v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
102+
32103 - run :
33- name : Run Core tests
34- command : env PYTEST_ADDOPTS="--exitfirst" make test
104+ name : Activate virtualenv
105+ command : echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV
35106
36107 - run :
37- name : Check NumPy typing against latest 3 minor versions
38- command : for i in {1..3}; do VERSION=$(.circleci/get-numpy-version.py prev) && pip install numpy==$VERSION && make check-types; done
108+ name : Run core & web-api tests
109+ command : PYTEST_ADDOPTS="--exitfirst" make test-code
39110
40111 - persist_to_workspace :
41112 root : .
42113 paths :
43114 - .coverage
44115
45116 - run :
46- name : Run Country Template tests
117+ name : Run country template tests
47118 command : |
48119 COUNTRY_TEMPLATE_PATH=`python -c "import openfisca_country_template; print(openfisca_country_template.CountryTaxBenefitSystem().get_package_metadata()['location'])"`
49120 openfisca test $COUNTRY_TEMPLATE_PATH/openfisca_country_template/tests/
@@ -85,20 +156,6 @@ jobs:
85156 name : Run doc tests
86157 command : make test-doc-build
87158
88-
89- check_version :
90- docker :
91- - image : python:3.7
92-
93- steps :
94- - checkout
95-
96- - run :
97- name : Check version number has been properly updated
98- command : |
99- git fetch
100- .circleci/is-version-number-acceptable.sh
101-
102159 submit_coverage :
103160 docker :
104161 - image : python:3.7
@@ -112,10 +169,13 @@ jobs:
112169 - restore_cache :
113170 key : v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
114171
172+ - run :
173+ name : Activate virtualenv
174+ command : echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV
175+
115176 - run :
116177 name : Submit coverage to Coveralls
117178 command : |
118- source /tmp/venv/openfisca_core/bin/activate
119179 pip install coveralls
120180 coveralls
121181
@@ -127,6 +187,7 @@ jobs:
127187 deploy :
128188 docker :
129189 - image : python:3.7
190+
130191 environment :
131192 PYPI_USERNAME : openfisca-bot
132193 # PYPI_PASSWORD: this value is set in CircleCI's web interface; do not set it here, it is a secret!
@@ -137,15 +198,17 @@ jobs:
137198 - restore_cache :
138199 key : v1-py3-{{ .Branch }}-{{ checksum "setup.py" }}
139200
201+ - run :
202+ name : Activate virtualenv
203+ command : echo "source /tmp/venv/openfisca_core/bin/activate" >> $BASH_ENV
204+
140205 - run :
141206 name : Check for functional changes
142207 command : if ! .circleci/has-functional-changes.sh ; then circleci step halt ; fi
143208
144209 - run :
145210 name : Upload a Python package to Pypi
146- command : |
147- source /tmp/venv/openfisca_core/bin/activate
148- .circleci/publish-python-package.sh
211+ command : .circleci/publish-python-package.sh
149212
150213 - run :
151214 name : Publish a git tag
@@ -160,17 +223,30 @@ workflows:
160223 version : 2
161224 build_and_deploy :
162225 jobs :
163- - run_tests
164- - test_docs
165226 - check_version
227+ - install
228+ - lint_style :
229+ requires :
230+ - install
231+ - lint_types :
232+ requires :
233+ - install
234+ - test_code :
235+ requires :
236+ - install
237+ - test_docs :
238+ requires :
239+ - install
166240 - submit_coverage :
167241 requires :
168- - run_tests
242+ - test_code
169243 - deploy :
170244 requires :
171- - run_tests
172- - test_docs
173245 - check_version
246+ - lint_style
247+ - lint_types
248+ - test_code
249+ - test_docs
174250 filters :
175251 branches :
176252 only : master
0 commit comments