Skip to content

Commit 46c7833

Browse files
committed
Merge branch 'automatic-upload-of-wheels-on-pypi' into dev
* automatic-upload-of-wheels-on-pypi: ci: Simplify release process directly uploading packages from CircleCI circleci: Group reusable keys under "references"
2 parents 17fc799 + 8a0bf81 commit 46c7833

File tree

2 files changed

+252
-207
lines changed

2 files changed

+252
-207
lines changed

.circleci/config.yml

Lines changed: 208 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,113 @@
1-
run-style-check: &run-style-check
2-
name: Run Style Checks
3-
command: |
4-
. ../venv/bin/activate
5-
pip install flake8
6-
flake8 src/pynwb
7-
flake8 tests
8-
flake8 --ignore E402,E501 docs/gallery
9-
10-
initialize-venv: &initialize-venv
11-
name: Initialize Virtual Environment
12-
command: |
13-
python -m virtualenv ../venv || python -m venv ../venv
14-
. ../venv/bin/activate
15-
16-
publish-prerelease-on-github: &publish-prerelease-on-github
17-
name: Publish wheel and source distribution on github
18-
command: |
19-
if [[ "${CIRCLE_BRANCH}" == "dev" && "${UPLOAD_WHEELS}" == "true" ]]; then
1+
version: 2
2+
3+
references:
4+
5+
run-style-check: &run-style-check
6+
name: Run Style Checks
7+
command: |
208
. ../venv/bin/activate
21-
pip install -U scikit-ci-addons
22-
ci_addons publish_github_release NeurodataWithoutBorders/pynwb \
23-
--prerelease-packages "dist/*" \
24-
--prerelease-sha dev \
25-
--prerelease-packages-clear-pattern "*" \
26-
--prerelease-packages-keep-pattern "*dev<COMMIT_DISTANCE>*" \
27-
--re-upload \
28-
--exit-success-if-missing-token
29-
fi
30-
31-
ci-steps: &ci-steps
32-
steps:
33-
- checkout
34-
- run:
35-
<<: *initialize-venv
36-
- run:
37-
name: Run the tests
38-
command: |
39-
. ../venv/bin/activate
40-
pip install tox
41-
tox -e $TEST_TOX_ENV
42-
# Install is expected to be quick. Increase timeout in case there are some network issues.
43-
# While pip installing tox does not output by default. Circle thinks task is dead after 10 min.
44-
no_output_timeout: 30m
45-
- run:
46-
name: Run coverage and submit to codecov-io
47-
command: |
48-
. ../venv/bin/activate
49-
tox -e $COVERAGE_TOX_ENV
50-
- run:
51-
name: Build wheel and source distribution
52-
command: |
53-
. ../venv/bin/activate
54-
tox -e $BUILD_TOX_ENV
55-
- run:
56-
name: Test installation from a wheel
57-
command: |
58-
. ../venv/bin/activate
59-
tox -e $TEST_WHEELINSTALL_ENV --recreate --installpkg dist/*-none-any.whl
60-
- run:
61-
<<: *publish-prerelease-on-github
62-
63-
conda-steps: &conda-steps
64-
steps:
65-
- checkout
66-
- run:
67-
name: Configure conda
68-
command: |
69-
conda config --set always_yes yes --set changeps1 no
70-
conda config --add channels conda-forge
71-
conda install virtualenv
72-
pip install tox
73-
- run:
74-
name: Run the tests
75-
command: |
76-
tox -e $TEST_TOX_ENV
77-
- run:
78-
name: Build wheel and source distribution
79-
command: |
80-
tox -e $BUILD_TOX_ENV
81-
- run:
82-
name: Test installation from a wheel
83-
command: |
84-
tox -e $TEST_WHEELINSTALL_ENV --recreate --installpkg dist/*-none-any.whl
85-
86-
gallery-steps: &gallery-steps
87-
steps:
88-
- checkout
89-
- restore_cache:
90-
keys:
91-
- ophys-data-cache
92-
- run:
93-
<<: *initialize-venv
94-
- run:
95-
name: Run the gallery tests
96-
command: |
97-
. ../venv/bin/activate
98-
pip install tox
99-
tox -e $TEST_TOX_ENV
100-
- save_cache:
101-
key: ophys-data-cache
102-
paths: ophys_experiment_data
9+
pip install flake8
10+
flake8 src/pynwb
11+
flake8 tests
12+
flake8 --ignore E402,E501 docs/gallery
13+
14+
initialize-venv: &initialize-venv
15+
name: Initialize Virtual Environment
16+
command: |
17+
python -m virtualenv ../venv || python -m venv ../venv
18+
. ../venv/bin/activate
19+
20+
ci-steps: &ci-steps
21+
steps:
22+
- checkout
23+
- run:
24+
<<: *initialize-venv
25+
- run:
26+
name: Run the tests
27+
command: |
28+
. ../venv/bin/activate
29+
pip install tox
30+
tox -e $TEST_TOX_ENV
31+
# Install is expected to be quick. Increase timeout in case there are some network issues.
32+
# While pip installing tox does not output by default. Circle thinks task is dead after 10 min.
33+
no_output_timeout: 30m
34+
- run:
35+
name: Run coverage and submit to codecov-io
36+
command: |
37+
. ../venv/bin/activate
38+
tox -e $COVERAGE_TOX_ENV
39+
- run:
40+
name: Build wheel and source distribution
41+
command: |
42+
. ../venv/bin/activate
43+
tox -e $BUILD_TOX_ENV
44+
- run:
45+
name: Test installation from a wheel
46+
command: |
47+
. ../venv/bin/activate
48+
tox -e $TEST_WHEELINSTALL_ENV --recreate --installpkg dist/*-none-any.whl
49+
- run:
50+
name: Remove distributions if UPLOAD_WHEELS != true
51+
command: |
52+
if [[ "${UPLOAD_WHEELS}" != "true" ]]; then
53+
echo "Discarding distributions"
54+
ls -1 dist
55+
rm -rf dist/*
56+
else
57+
echo "Keeping distributions for upload"
58+
ls -1 dist
59+
fi
60+
- persist_to_workspace:
61+
root: ./
62+
paths:
63+
- dist
64+
65+
conda-steps: &conda-steps
66+
steps:
67+
- checkout
68+
- run:
69+
name: Configure conda
70+
command: |
71+
conda config --set always_yes yes --set changeps1 no
72+
conda config --add channels conda-forge
73+
conda install virtualenv
74+
pip install tox
75+
- run:
76+
name: Run the tests
77+
command: |
78+
tox -e $TEST_TOX_ENV
79+
- run:
80+
name: Build wheel and source distribution
81+
command: |
82+
tox -e $BUILD_TOX_ENV
83+
- run:
84+
name: Test installation from a wheel
85+
command: |
86+
tox -e $TEST_WHEELINSTALL_ENV --recreate --installpkg dist/*-none-any.whl
87+
88+
gallery-steps: &gallery-steps
89+
steps:
90+
- checkout
91+
- restore_cache:
92+
keys:
93+
- ophys-data-cache
94+
- run:
95+
<<: *initialize-venv
96+
- run:
97+
name: Run the gallery tests
98+
command: |
99+
. ../venv/bin/activate
100+
pip install tox
101+
tox -e $TEST_TOX_ENV
102+
- save_cache:
103+
key: ophys-data-cache
104+
paths: ophys_experiment_data
105+
106+
no_filters: &no_filters
107+
filters:
108+
tags:
109+
only: /.*/
103110

104-
version: 2
105111
jobs:
106112
flake8:
107113
docker:
@@ -191,17 +197,107 @@ jobs:
191197
- TEST_TOX_ENV: "gallery-py36"
192198
<<: *gallery-steps
193199

200+
deploy-dev:
201+
docker:
202+
- image: circleci/python:3.7.0-stretch
203+
steps:
204+
- checkout
205+
- attach_workspace:
206+
at: ./
207+
- run:
208+
name: Publish wheel and source distribution as a GitHub pre-release
209+
command: |
210+
python -m venv ../venv
211+
. ../venv/bin/activate
212+
pip install -U scikit-ci-addons
213+
echo "CIRCLE_SHA1 [$CIRCLE_SHA1]"
214+
ci_addons publish_github_release NeurodataWithoutBorders/pynwb \
215+
--prerelease-packages "dist/*" \
216+
--prerelease-sha $CIRCLE_SHA1 \
217+
--prerelease-packages-clear-pattern "*" \
218+
--prerelease-packages-keep-pattern "*dev<COMMIT_DISTANCE>*" \
219+
--re-upload \
220+
--exit-success-if-missing-token
221+
222+
deploy-release:
223+
docker:
224+
- image: circleci/python:3.7.0-stretch
225+
steps:
226+
- attach_workspace:
227+
at: ./
228+
- run:
229+
name: Deploy release
230+
command: |
231+
echo "Deploy release"
232+
python -m venv ../venv
233+
. ../venv/bin/activate
234+
pip install twine
235+
ls dist
236+
twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
237+
- run:
238+
name: Publish wheel and source distribution as a GitHub release
239+
command: |
240+
python -m venv ../venv
241+
. ../venv/bin/activate
242+
pip install githubrelease
243+
githubrelease release $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
244+
create $CIRCLE_TAG --name $CIRCLE_TAG \
245+
--publish ./dist/*
246+
194247
workflows:
195248
version: 2
196249
test-package-publish:
197250
jobs:
198-
- flake8
199-
- python27
200-
- python35
201-
- python36
202-
- miniconda27
203-
- miniconda35
204-
- miniconda36
205-
- gallery27
206-
- gallery35
207-
- gallery36
251+
- flake8:
252+
<<: *no_filters
253+
- python27:
254+
<<: *no_filters
255+
- python35:
256+
<<: *no_filters
257+
- python36:
258+
<<: *no_filters
259+
- miniconda27:
260+
<<: *no_filters
261+
- miniconda35:
262+
<<: *no_filters
263+
- miniconda36:
264+
<<: *no_filters
265+
- gallery27:
266+
<<: *no_filters
267+
- gallery35:
268+
<<: *no_filters
269+
- gallery36:
270+
<<: *no_filters
271+
- deploy-dev:
272+
requires:
273+
- flake8
274+
- python27
275+
- python35
276+
- python36
277+
- miniconda27
278+
- miniconda35
279+
- miniconda36
280+
- gallery27
281+
- gallery35
282+
- gallery36
283+
filters:
284+
branches:
285+
only: dev
286+
- deploy-release:
287+
requires:
288+
- flake8
289+
- python27
290+
- python35
291+
- python36
292+
- miniconda27
293+
- miniconda35
294+
- miniconda36
295+
- gallery27
296+
- gallery35
297+
- gallery36
298+
filters:
299+
tags:
300+
only: /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
301+
branches:
302+
ignore: /.*/
303+

0 commit comments

Comments
 (0)