Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2f6a7f

Browse files
committed
Circle: Convert config into re-usable command style.
This allows embedding multiple steps into a command.
1 parent 3232f58 commit b2f6a7f

File tree

1 file changed

+108
-91
lines changed

1 file changed

+108
-91
lines changed

.circleci/config.yml

Lines changed: 108 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,94 @@
44
version: 2.1
55

66

7-
###########################################
8-
# Define some common steps as YAML anchors.
7+
#######################################
8+
# Define some common steps as commands.
99
#
1010

11-
apt-run: &apt-install
12-
name: Install apt packages
13-
command: |
14-
sudo apt -qq update
15-
sudo apt install -y \
16-
inkscape \
17-
ffmpeg \
18-
dvipng \
19-
lmodern \
20-
cm-super \
21-
texlive-latex-base \
22-
texlive-latex-extra \
23-
texlive-fonts-recommended \
24-
texlive-latex-recommended \
25-
texlive-pictures \
26-
texlive-xetex \
27-
graphviz \
28-
fonts-crosextra-carlito \
29-
fonts-freefont-otf \
30-
fonts-humor-sans
31-
32-
fonts-run: &fonts-install
33-
name: Install custom fonts
34-
command: |
35-
mkdir -p ~/.local/share/fonts
36-
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
37-
fc-cache -f -v
38-
save_cache:
39-
key: fonts-2
40-
paths:
41-
- ~/.local/share/fonts/
42-
restore_cache:
43-
key: fonts-2
44-
45-
pip-run: &pip-install
46-
# Upgrade pip and setuptools and wheel to get as clean an install as possible
47-
name: Upgrade pip, setuptools, wheel
48-
command: |
49-
python -mpip install --upgrade --user pip
50-
python -mpip install --upgrade --user wheel
51-
python -mpip install --upgrade --user setuptools
52-
53-
deps-run: &deps-install
54-
name: Install Python dependencies
55-
command: |
56-
python -mpip install --user numpy${NUMPY_VERSION} codecov coverage
57-
python -mpip install --user -r requirements/doc/doc-requirements.txt
58-
59-
mpl-run: &mpl-install
60-
name: Install Matplotlib
61-
command: python -mpip install --user -ve .
62-
63-
doc-run: &doc-build
64-
name: Build documentation
65-
command: |
66-
# Set epoch to date of latest tag.
67-
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
68-
make html O=-T
69-
rm -r build/html/_sources
70-
working_directory: doc
71-
72-
doc-bundle-run: &doc-bundle
73-
name: Bundle sphinx-gallery documentation artifacts
74-
command: tar cf doc/build/sphinx-gallery-files.tar.gz doc/api/_as_gen doc/gallery doc/tutorials
75-
when: always
11+
commands:
12+
apt-install:
13+
steps:
14+
- run:
15+
name: Install apt packages
16+
command: |
17+
sudo apt -qq update
18+
sudo apt install -y \
19+
inkscape \
20+
ffmpeg \
21+
dvipng \
22+
lmodern \
23+
cm-super \
24+
texlive-latex-base \
25+
texlive-latex-extra \
26+
texlive-fonts-recommended \
27+
texlive-latex-recommended \
28+
texlive-pictures \
29+
texlive-xetex \
30+
graphviz \
31+
fonts-crosextra-carlito \
32+
fonts-freefont-otf \
33+
fonts-humor-sans
34+
35+
fonts-install:
36+
steps:
37+
- run:
38+
name: Install custom fonts
39+
command: |
40+
mkdir -p ~/.local/share/fonts
41+
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
42+
fc-cache -f -v
43+
save_cache:
44+
key: fonts-2
45+
paths:
46+
- ~/.local/share/fonts/
47+
restore_cache:
48+
key: fonts-2
49+
50+
pip-install:
51+
description: Upgrade pip and setuptools and wheel to get as clean an install as possible
52+
steps:
53+
- run:
54+
name: Upgrade pip, setuptools, wheel
55+
command: |
56+
python -mpip install --upgrade --user pip
57+
python -mpip install --upgrade --user wheel
58+
python -mpip install --upgrade --user setuptools
59+
60+
deps-install:
61+
parameters:
62+
numpy_version:
63+
type: string
64+
default: ""
65+
steps:
66+
- run:
67+
name: Install Python dependencies
68+
command: |
69+
python -mpip install --user numpy<< parameters.numpy_version >> codecov coverage
70+
python -mpip install --user -r requirements/doc/doc-requirements.txt
71+
72+
mpl-install:
73+
steps:
74+
- run:
75+
name: Install Matplotlib
76+
command: python -mpip install --user -ve .
77+
78+
doc-build:
79+
steps:
80+
- run:
81+
name: Build documentation
82+
command: |
83+
# Set epoch to date of latest tag.
84+
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
85+
make html O=-T
86+
rm -r build/html/_sources
87+
working_directory: doc
88+
89+
doc-bundle:
90+
steps:
91+
- run:
92+
name: Bundle sphinx-gallery documentation artifacts
93+
command: tar cf doc/build/sphinx-gallery-files.tar.gz doc/api/_as_gen doc/gallery doc/tutorials
94+
when: always
7695

7796

7897
##########################################
@@ -86,18 +105,16 @@ jobs:
86105
steps:
87106
- checkout
88107

89-
- run: *apt-install
90-
- run: *fonts-install
91-
- run: *pip-install
92-
- run:
93-
<<: *deps-install
94-
environment:
95-
NUMPY_VERSION: "==1.13.0"
96-
- run: *mpl-install
108+
- apt-install
109+
- fonts-install
110+
- pip-install
111+
- deps-install:
112+
numpy_version: "==1.13.0"
113+
- mpl-install
97114

98-
- run: *doc-build
115+
- doc-build
99116

100-
- run: *doc-bundle
117+
- doc-bundle
101118
- store_artifacts:
102119
path: doc/build/sphinx-gallery-files.tar.gz
103120

@@ -110,16 +127,16 @@ jobs:
110127
steps:
111128
- checkout
112129

113-
- run: *apt-install
114-
- run: *fonts-install
115-
- run: *pip-install
130+
- apt-install
131+
- fonts-install
132+
- pip-install
116133

117-
- run: *deps-install
118-
- run: *mpl-install
134+
- deps-install
135+
- mpl-install
119136

120-
- run: *doc-build
137+
- doc-build
121138

122-
- run: *doc-bundle
139+
- doc-bundle
123140
- store_artifacts:
124141
path: doc/build/sphinx-gallery-files.tar.gz
125142

@@ -132,16 +149,16 @@ jobs:
132149
steps:
133150
- checkout
134151

135-
- run: *apt-install
136-
- run: *fonts-install
137-
- run: *pip-install
152+
- apt-install
153+
- fonts-install
154+
- pip-install
138155

139-
- run: *deps-install
140-
- run: *mpl-install
156+
- deps-install
157+
- mpl-install
141158

142-
- run: *doc-build
159+
- doc-build
143160

144-
- run: *doc-bundle
161+
- doc-bundle
145162
- store_artifacts:
146163
path: doc/build/sphinx-gallery-files.tar.gz
147164

0 commit comments

Comments
 (0)