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

Skip to content

Commit 18e3b2a

Browse files
committed
Circle: Convert config into re-usable command style.
This allows embedding multiple steps into a command.
1 parent 9ccdb1d commit 18e3b2a

1 file changed

Lines changed: 109 additions & 92 deletions

File tree

.circleci/config.yml

Lines changed: 109 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,95 @@
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-
optipng
32-
33-
fonts-run: &fonts-install
34-
name: Install custom fonts
35-
command: |
36-
mkdir -p ~/.local/share/fonts
37-
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
38-
fc-cache -f -v
39-
save_cache:
40-
key: fonts-2
41-
paths:
42-
- ~/.local/share/fonts/
43-
restore_cache:
44-
key: fonts-2
45-
46-
pip-run: &pip-install
47-
# Upgrade pip and setuptools and wheel to get as clean an install as possible
48-
name: Upgrade pip, setuptools, wheel
49-
command: |
50-
python -mpip install --upgrade --user pip
51-
python -mpip install --upgrade --user wheel
52-
python -mpip install --upgrade --user setuptools
53-
54-
deps-run: &deps-install
55-
name: Install Python dependencies
56-
command: |
57-
python -mpip install --user numpy${NUMPY_VERSION} codecov coverage
58-
python -mpip install --user -r requirements/doc/doc-requirements.txt
59-
60-
mpl-run: &mpl-install
61-
name: Install Matplotlib
62-
command: python -mpip install --user -ve .
63-
64-
doc-run: &doc-build
65-
name: Build documentation
66-
command: |
67-
# Set epoch to date of latest tag.
68-
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
69-
make html O=-T
70-
rm -r build/html/_sources
71-
working_directory: doc
72-
73-
doc-bundle-run: &doc-bundle
74-
name: Bundle sphinx-gallery documentation artifacts
75-
command: tar cf doc/build/sphinx-gallery-files.tar.gz doc/api/_as_gen doc/gallery doc/tutorials
76-
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+
optipng
35+
36+
fonts-install:
37+
steps:
38+
- run:
39+
name: Install custom fonts
40+
command: |
41+
mkdir -p ~/.local/share/fonts
42+
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
43+
fc-cache -f -v
44+
save_cache:
45+
key: fonts-2
46+
paths:
47+
- ~/.local/share/fonts/
48+
restore_cache:
49+
key: fonts-2
50+
51+
pip-install:
52+
description: Upgrade pip and setuptools and wheel to get as clean an install as possible
53+
steps:
54+
- run:
55+
name: Upgrade pip, setuptools, wheel
56+
command: |
57+
python -mpip install --upgrade --user pip
58+
python -mpip install --upgrade --user wheel
59+
python -mpip install --upgrade --user setuptools
60+
61+
deps-install:
62+
parameters:
63+
numpy_version:
64+
type: string
65+
default: ""
66+
steps:
67+
- run:
68+
name: Install Python dependencies
69+
command: |
70+
python -mpip install --user numpy<< parameters.numpy_version >> codecov coverage
71+
python -mpip install --user -r requirements/doc/doc-requirements.txt
72+
73+
mpl-install:
74+
steps:
75+
- run:
76+
name: Install Matplotlib
77+
command: python -mpip install --user -ve .
78+
79+
doc-build:
80+
steps:
81+
- run:
82+
name: Build documentation
83+
command: |
84+
# Set epoch to date of latest tag.
85+
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
86+
make html O=-T
87+
rm -r build/html/_sources
88+
working_directory: doc
89+
90+
doc-bundle:
91+
steps:
92+
- run:
93+
name: Bundle sphinx-gallery documentation artifacts
94+
command: tar cf doc/build/sphinx-gallery-files.tar.gz doc/api/_as_gen doc/gallery doc/tutorials
95+
when: always
7796

7897

7998
##########################################
@@ -87,18 +106,16 @@ jobs:
87106
steps:
88107
- checkout
89108

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

99-
- run: *doc-build
116+
- doc-build
100117

101-
- run: *doc-bundle
118+
- doc-bundle
102119
- store_artifacts:
103120
path: doc/build/sphinx-gallery-files.tar.gz
104121

@@ -111,16 +128,16 @@ jobs:
111128
steps:
112129
- checkout
113130

114-
- run: *apt-install
115-
- run: *fonts-install
116-
- run: *pip-install
131+
- apt-install
132+
- fonts-install
133+
- pip-install
117134

118-
- run: *deps-install
119-
- run: *mpl-install
135+
- deps-install
136+
- mpl-install
120137

121-
- run: *doc-build
138+
- doc-build
122139

123-
- run: *doc-bundle
140+
- doc-bundle
124141
- store_artifacts:
125142
path: doc/build/sphinx-gallery-files.tar.gz
126143

@@ -133,16 +150,16 @@ jobs:
133150
steps:
134151
- checkout
135152

136-
- run: *apt-install
137-
- run: *fonts-install
138-
- run: *pip-install
153+
- apt-install
154+
- fonts-install
155+
- pip-install
139156

140-
- run: *deps-install
141-
- run: *mpl-install
157+
- deps-install
158+
- mpl-install
142159

143-
- run: *doc-build
160+
- doc-build
144161

145-
- run: *doc-bundle
162+
- doc-bundle
146163
- store_artifacts:
147164
path: doc/build/sphinx-gallery-files.tar.gz
148165

0 commit comments

Comments
 (0)