Skip to content

Commit 665b78d

Browse files
committed
reduce duplication with circleci commands
1 parent 18ff7d9 commit 665b78d

File tree

1 file changed

+86
-182
lines changed

1 file changed

+86
-182
lines changed

.circleci/config.yml

Lines changed: 86 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,69 @@
1-
version: 2
1+
version: 2.1
2+
3+
commands:
4+
test-core:
5+
parameters:
6+
py:
7+
default: "36"
8+
type: string
9+
steps:
10+
- checkout
11+
- run:
12+
name: Install dependencies
13+
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_<<parameters.py>>_core.txt"
14+
- run:
15+
name: Test core
16+
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
17+
no_output_timeout: 20m
18+
19+
test-optional:
20+
parameters:
21+
py:
22+
default: "36"
23+
type: string
24+
steps:
25+
- checkout
26+
- run:
27+
name: Install dependencies
28+
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_optional.txt"
29+
- run:
30+
name: Install plotly-geo
31+
command: "cd packages/python/plotly-geo; sudo pip install -e ."
32+
- run:
33+
name: Install orca
34+
command: |
35+
sudo npm install [email protected] sudo npm install orca
36+
sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2 rename
37+
echo 'export PATH="/home/circleci/project/node_modules/.bin:$PATH"' >> $BASH_ENV
38+
- run:
39+
name: Test core
40+
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
41+
no_output_timeout: 20m
42+
- run:
43+
name: Test optional
44+
command: "cd packages/python/plotly; pytest plotly/tests/test_optional"
45+
no_output_timeout: 40m
46+
- run:
47+
name: Test utils
48+
command: "cd packages/python/plotly; pytest _plotly_utils/tests/"
49+
no_output_timeout: 20m
50+
- run:
51+
name: Test io
52+
command: "cd packages/python/plotly; pytest plotly/tests/test_io"
53+
no_output_timeout: 20m
54+
- run:
55+
name: Test dependencdies not imported
56+
command: "cd packages/python/plotly; pytest -x test_init/test_dependencies_not_imported.py"
57+
- run:
58+
name: Test lazy imports
59+
command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py"
60+
- run:
61+
name: Test orca
62+
command: "cd packages/python/plotly; pytest plotly/tests/test_orca"
63+
no_output_timeout: 20m
64+
- store_artifacts:
65+
path: packages/python/plotly/plotly/tests/test_orca/images/linux/failed
66+
267

368
jobs:
469
check-code-formatting:
@@ -18,55 +83,30 @@ jobs:
1883
python-3.6-core:
1984
docker:
2085
- image: circleci/python:3.6-stretch-node-browsers
21-
2286
steps:
23-
- checkout
24-
- run:
25-
name: Install dependencies
26-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_36_core.txt"
27-
- run:
28-
name: Test core
29-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
30-
no_output_timeout: 20m
87+
- test-core:
88+
py: "36"
3189

3290
python-3.7-core:
3391
docker:
3492
- image: circleci/python:3.7-stretch-node-browsers
3593
steps:
36-
- checkout
37-
- run:
38-
name: Install dependencies
39-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_37_core.txt"
40-
- run:
41-
name: Test core
42-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
43-
no_output_timeout: 20m
94+
- test-core:
95+
py: "37"
4496

4597
python-3.8-core:
4698
docker:
4799
- image: circleci/python:3.8-buster-node-browsers
48100
steps:
49-
- checkout
50-
- run:
51-
name: Install dependencies
52-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_core.txt"
53-
- run:
54-
name: Test core
55-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
56-
no_output_timeout: 20m
101+
- test-core:
102+
py: "38"
57103

58104
python-3.9-core:
59105
docker:
60106
- image: circleci/python:3.9-buster-node-browsers
61107
steps:
62-
- checkout
63-
- run:
64-
name: Install dependencies
65-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_39_core.txt"
66-
- run:
67-
name: Test core
68-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
69-
no_output_timeout: 20m
108+
- test-core:
109+
py: "39"
70110

71111
python-3.7-percy:
72112
docker:
@@ -100,141 +140,35 @@ jobs:
100140
npx percy snapshot test/percy/
101141
rm test/percy/*.html
102142
143+
103144
# Optional
104145
python-3.6-optional:
105146
docker:
106147
- image: circleci/python:3.6-stretch-node-browsers
107-
108148
steps:
109-
- checkout
110-
- run:
111-
name: Install dependencies
112-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_36_optional.txt"
113-
- run:
114-
name: Install plotly-geo
115-
command: "cd packages/python/plotly-geo; sudo pip install -e ."
116-
- run:
117-
name: Test core
118-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
119-
no_output_timeout: 20m
120-
- run:
121-
name: Test optional
122-
command: "cd packages/python/plotly; pytest plotly/tests/test_optional"
123-
no_output_timeout: 40m
124-
- run:
125-
name: Test utils
126-
command: "cd packages/python/plotly; pytest _plotly_utils/tests/"
127-
no_output_timeout: 20m
128-
- run:
129-
name: Test io
130-
command: "cd packages/python/plotly; pytest plotly/tests/test_io"
131-
no_output_timeout: 20m
149+
- test-optional:
150+
py: "36"
132151

133152
python-3.7-optional:
134153
docker:
135154
- image: circleci/python:3.7-stretch-node-browsers
136-
137155
steps:
138-
- checkout
139-
- run:
140-
name: Install dependencies
141-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_37_optional.txt"
142-
- run:
143-
name: Install plotly-geo
144-
command: "cd packages/python/plotly-geo; sudo pip install -e ."
145-
- run:
146-
name: Test core
147-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
148-
no_output_timeout: 20m
149-
- run:
150-
name: Test optional
151-
command: "cd packages/python/plotly; pytest plotly/tests/test_optional"
152-
no_output_timeout: 40m
153-
- run:
154-
name: Test utils
155-
command: "cd packages/python/plotly; pytest _plotly_utils/tests/"
156-
no_output_timeout: 20m
157-
- run:
158-
name: Test io
159-
command: "cd packages/python/plotly; pytest plotly/tests/test_io"
160-
no_output_timeout: 20m
161-
- run:
162-
name: Test dependencdies not imported
163-
command: "cd packages/python/plotly; pytest -x test_init/test_dependencies_not_imported.py"
164-
- run:
165-
name: Test lazy imports
166-
command: "cd packages/python/plotly; pytest -x test_init/test_lazy_imports.py"
156+
- test-optional:
157+
py: "37"
167158

168159
python-3.8-optional:
169160
docker:
170161
- image: circleci/python:3.8-buster-node-browsers
171-
172162
steps:
173-
- checkout
174-
- run:
175-
name: Install dependencies
176-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_38_optional.txt"
177-
- run:
178-
name: Install plotly-geo
179-
command: "cd packages/python/plotly-geo; sudo pip install -e ."
180-
- run:
181-
name: Install orca
182-
command: |
183-
sudo npm install [email protected] sudo npm install orca
184-
sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2 rename
185-
echo 'export PATH="/home/circleci/project/node_modules/.bin:$PATH"' >> $BASH_ENV
186-
187-
# - run:
188-
# name: Test core
189-
# command: "cd packages/python/plotly; pytest plotly/tests/test_core"
190-
# no_output_timeout: 20m
191-
# - run:
192-
# name: Test optional
193-
# command: "cd packages/python/plotly; pytest plotly/tests/test_optional"
194-
# no_output_timeout: 40m
195-
# - run:
196-
# name: Test utils
197-
# command: "cd packages/python/plotly; pytest _plotly_utils/tests/"
198-
# no_output_timeout: 20m
199-
# - run:
200-
# name: Test io
201-
# command: "cd packages/python/plotly; pytest plotly/tests/test_io"
202-
# no_output_timeout: 20m
203-
- run:
204-
name: Test orca
205-
command: "cd packages/python/plotly; pytest plotly/tests/test_orca"
206-
no_output_timeout: 20m
207-
- store_artifacts:
208-
path: packages/python/plotly/plotly/tests/test_orca/images/linux/failed
163+
- test-optional:
164+
py: "38"
209165

210166
python-3.9-optional:
211167
docker:
212168
- image: circleci/python:3.9-buster-node-browsers
213-
214169
steps:
215-
- checkout
216-
- run:
217-
name: Install dependencies
218-
command: "cd packages/python; sudo pip install -r ./plotly/test_requirements/requirements_39_optional.txt"
219-
- run:
220-
name: Install plotly-geo
221-
command: "cd packages/python/plotly-geo; sudo pip install -e ."
222-
- run:
223-
name: Test core
224-
command: "cd packages/python/plotly; pytest plotly/tests/test_core"
225-
no_output_timeout: 20m
226-
- run:
227-
name: Test optional
228-
command: "cd packages/python/plotly; pytest plotly/tests/test_optional"
229-
no_output_timeout: 40m
230-
- run:
231-
name: Test utils
232-
command: "cd packages/python/plotly; pytest _plotly_utils/tests/"
233-
no_output_timeout: 20m
234-
- run:
235-
name: Test io
236-
command: "cd packages/python/plotly; pytest plotly/tests/test_io"
237-
no_output_timeout: 20m
170+
- test-optional:
171+
py: "39"
238172

239173
# Chart studio
240174
python-3.7-chart_studio:
@@ -251,35 +185,6 @@ jobs:
251185
command: "cd packages/python/chart-studio; pytest -x chart_studio/tests/"
252186
no_output_timeout: 20m
253187

254-
python-3-7-orca:
255-
docker:
256-
- image: circleci/python:3.7-stretch-node-browsers
257-
258-
steps:
259-
- checkout
260-
- restore_cache:
261-
keys:
262-
- conda-37-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }}-{{ checksum "packages/python/plotly/test_requirements/requirements_37_optional.txt" }}
263-
- run:
264-
name: Create conda environment
265-
command: .circleci/create_conda_optional_env.sh
266-
267-
- save_cache:
268-
key: conda-37-v1-{{ checksum ".circleci/create_conda_optional_env.sh" }}
269-
paths:
270-
- /home/circleci/miniconda/
271-
- run:
272-
name: Run Tests
273-
command: |
274-
. /home/circleci/miniconda/etc/profile.d/conda.sh
275-
conda activate circle_optional
276-
pytest --doctest-modules --ignore packages/python/plotly/plotly/tests --ignore packages/python/plotly/plotly/matplotlylib/mplexporter/tests packages/python/plotly/plotly
277-
pytest --disable-warnings packages/python/plotly/plotly/tests/test_core
278-
pytest packages/python/plotly/plotly/tests/test_orca
279-
280-
- store_artifacts:
281-
path: packages/python/plotly/plotly/tests/test_orca/images/linux/failed
282-
283188
plotlyjs_dev_build:
284189
docker:
285190
- image: circleci/python:3.7-stretch-node-browsers
@@ -477,15 +382,14 @@ workflows:
477382

478383
build:
479384
jobs:
480-
# - python-3.6-core
385+
- python-3.6-core
481386
# - python-3.7-core
482-
# - python-3.8-core
387+
- python-3.8-core
483388
# - python-3.9-core
484389
# - python-3.7-percy
485-
# - python-3.6-optional
390+
- python-3.6-optional
486391
# - python-3.7-optional
487392
- python-3.8-optional
488393
# - python-3.9-optional
489394
# - python-3.7-chart_studio
490-
# - python-3-7-orca
491395
# - build-doc

0 commit comments

Comments
 (0)