Skip to content

Update configuration of CircleCI builds #17183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 119 additions & 98 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,105 @@
version: 2.1


###########################################
# Define some common steps as YAML anchors.
#######################################
# Define some common steps as commands.
#

apt-run: &apt-install
name: Install apt packages
command: |
sudo apt -qq update
sudo apt install -y \
inkscape \
ffmpeg \
dvipng \
lmodern \
cm-super \
texlive-latex-base \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-latex-recommended \
texlive-pictures \
texlive-xetex \
graphviz \
fonts-crosextra-carlito \
fonts-freefont-otf \
fonts-humor-sans \
optipng

fonts-run: &fonts-install
name: Install custom fonts
command: |
mkdir -p ~/.local/share/fonts
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
fc-cache -f -v
save_cache:
key: fonts-2
paths:
- ~/.local/share/fonts/
restore_cache:
key: fonts-2

pip-run: &pip-install
# Upgrade pip and setuptools and wheel to get as clean an install as possible
name: Upgrade pip, setuptools, wheel
command: |
python -mpip install --upgrade --user pip
python -mpip install --upgrade --user wheel
python -mpip install --upgrade --user setuptools

deps-run: &deps-install
name: Install Python dependencies
command: |
python -mpip install --user numpy${NUMPY_VERSION} codecov coverage
python -mpip install --user -r requirements/doc/doc-requirements.txt

mpl-run: &mpl-install
name: Install Matplotlib
command: python -mpip install --user -ve .

doc-run: &doc-build
name: Build documentation
command: |
# Set epoch to date of latest tag.
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
make html O=-T
rm -r build/html/_sources
working_directory: doc

doc-bundle-run: &doc-bundle
name: Bundle sphinx-gallery documentation artifacts
command: tar cf doc/build/sphinx-gallery-files.tar.gz doc/api/_as_gen doc/gallery doc/tutorials
when: always
commands:
apt-install:
steps:
- run:
name: Install apt packages
command: |
sudo apt -qq update
sudo apt install -y \
inkscape \
ffmpeg \
dvipng \
lmodern \
cm-super \
texlive-latex-base \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-latex-recommended \
texlive-pictures \
texlive-xetex \
graphviz \
fonts-crosextra-carlito \
fonts-freefont-otf \
fonts-humor-sans \
optipng

fonts-install:
steps:
- restore_cache:
key: fonts-2
- run:
name: Install custom fonts
command: |
mkdir -p ~/.local/share/fonts
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
fc-cache -f -v
- save_cache:
key: fonts-2
paths:
- ~/.local/share/fonts/

pip-install:
description: Upgrade pip and setuptools and wheel to get as clean an install as possible
steps:
- run:
name: Upgrade pip, setuptools, wheel
command: |
python -mpip install --upgrade --user pip
python -mpip install --upgrade --user wheel
python -mpip install --upgrade --user setuptools

deps-install:
parameters:
numpy_version:
type: string
default: ""
steps:
- run:
name: Install Python dependencies
command: |
python -mpip install --user numpy<< parameters.numpy_version >> codecov coverage
python -mpip install --user -r requirements/doc/doc-requirements.txt

mpl-install:
steps:
- run:
name: Install Matplotlib
command: python -mpip install --user -ve .

doc-build:
steps:
- restore_cache:
keys:
- sphinx-env-v1-{{ .BuildNum }}-{{ .Environment.CIRCLE_JOB }}
- sphinx-env-v1-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}-{{ .Environment.CIRCLE_JOB }}
- run:
name: Build documentation
command: |
# Set epoch to date of latest tag.
export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))"
make html O=-T
rm -r build/html/_sources
working_directory: doc
- save_cache:
key: sphinx-env-v1-{{ .BuildNum }}-{{ .Environment.CIRCLE_JOB }}
paths:
- doc/build/doctrees

doc-bundle:
steps:
- run:
name: Bundle sphinx-gallery documentation artifacts
command: tar cf doc/build/sphinx-gallery-files.tar.gz doc/api/_as_gen doc/gallery doc/tutorials
when: always
- store_artifacts:
path: doc/build/sphinx-gallery-files.tar.gz


##########################################
Expand All @@ -87,20 +116,16 @@ jobs:
steps:
- checkout

- run: *apt-install
- run: *fonts-install
- run: *pip-install
- run:
<<: *deps-install
environment:
NUMPY_VERSION: "==1.13.0"
- run: *mpl-install
- apt-install
- fonts-install
- pip-install
- deps-install:
numpy_version: "==1.13.0"
- mpl-install

- run: *doc-build
- doc-build

- run: *doc-bundle
- store_artifacts:
path: doc/build/sphinx-gallery-files.tar.gz
- doc-bundle

- store_artifacts:
path: doc/build/html
Expand All @@ -111,18 +136,16 @@ jobs:
steps:
- checkout

- run: *apt-install
- run: *fonts-install
- run: *pip-install
- apt-install
- fonts-install
- pip-install

- run: *deps-install
- run: *mpl-install
- deps-install
- mpl-install

- run: *doc-build
- doc-build

- run: *doc-bundle
- store_artifacts:
path: doc/build/sphinx-gallery-files.tar.gz
- doc-bundle

- store_artifacts:
path: doc/build/html
Expand All @@ -133,18 +156,16 @@ jobs:
steps:
- checkout

- run: *apt-install
- run: *fonts-install
- run: *pip-install
- apt-install
- fonts-install
- pip-install

- run: *deps-install
- run: *mpl-install
- deps-install
- mpl-install

- run: *doc-build
- doc-build

- run: *doc-bundle
- store_artifacts:
path: doc/build/sphinx-gallery-files.tar.gz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this artifact?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure; it was originally there to confirm that sphinx-gallery was working, but that seems rather rare these days. On the other hand, it really doesn't spend much time doing this at all.

- doc-bundle

- store_artifacts:
path: doc/build/html
Expand Down