Skip to content

Commit bebdae0

Browse files
authored
Merge pull request #57 from jimustafa/master
add workflow for building artifacts
2 parents 92d26b5 + d074da7 commit bebdae0

26 files changed

+334
-52
lines changed

.github/workflows/main.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,45 @@ jobs:
99
- uses: actions/checkout@v2
1010
- uses: actions/setup-python@v2
1111
- uses: pre-commit/[email protected]
12+
build:
13+
runs-on: ubuntu-20.04
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.6
19+
- name: Install dependencies
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install \
23+
fontconfig \
24+
libgeos++-dev \
25+
libproj-dev
26+
python -m pip install --upgrade pip
27+
pip install -r requirements/requirements-base.txt
28+
pip install -r requirements/requirements.txt
29+
- name: Install Tex Live
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install \
33+
texlive-base \
34+
texlive-extra-utils \
35+
texlive-fonts-extra \
36+
texlive-fonts-recommended \
37+
texlive-latex-base \
38+
texlive-latex-extra \
39+
texlive-latex-recommended \
40+
texlive-xetex
41+
- name: Build artifacts
42+
run: |
43+
rm *.pdf
44+
make -C fonts/
45+
cp -r fonts/ /usr/share/fonts/
46+
fc-cache
47+
make figures cheatsheets handouts
48+
- uses: actions/upload-artifact@v2
49+
with:
50+
name: build
51+
path: |
52+
cheatsheets.pdf
53+
handout-*.pdf

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
fonts/*
2-
*.upa
1+
*.aux
32
*.log
43
*.out
5-
*.aux
4+
*.upa
65
figures/*.pdf
6+
fonts/**/*.[ot]tf

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
SRC := $(wildcard *.tex)
2+
3+
.PHONY: default
4+
default: all
5+
6+
.PHONY: all
7+
all: figures cheatsheets
8+
9+
.PHONY: figures
10+
figures:
11+
# generate the figures
12+
cd scripts && for script in *.py; do echo $$script; python $$script; done
13+
# crop the figures
14+
cd figures && for figure in *.pdf; do echo $$figure; pdfcrop $$figure $$figure; done
15+
# regenerate some figures that should not be cropped
16+
cd scripts && python styles.py
17+
18+
.PHONY: cheatsheets
19+
cheatsheets:
20+
xelatex cheatsheets.tex
21+
22+
.PHONY: handouts
23+
handouts:
24+
xelatex handout-beginner.tex
25+
xelatex handout-intermediate.tex
26+
xelatex handout-tips.tex
27+
28+
.PHONY: fonts
29+
fonts:
30+
make -C fonts/
31+
32+
.PHONY: clean
33+
clean: $(SRC)
34+
git clean -f -X ./figures/
35+
git clean -f ./scripts/*.pdf
36+
latexmk -c $^
37+
38+
.PHONY: requirements
39+
requirements:
40+
$(MAKE) -C ./requirements/

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,21 @@
2828
or https://github.com/adobe-fonts/source-serif-pro/tree/release/OTF
2929
* `fonts/delicious-123/*` : See https://www.exljbris.com/delicious.html
3030

31+
On Linux, with `make` installed, the fonts can be set up with the following command:
32+
```shell
33+
make -C fonts
34+
```
3135

36+
The fonts can be made discoverable by `matplotlib` (through `fontconfig`) by creating the following in `$HOME/.config/fontconfig/fonts.conf` (see [here](https://www.freedesktop.org/software/fontconfig/fontconfig-user.html)):
3237

38+
```xml
39+
<?xml version="1.0"?>
40+
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
41+
<fontconfig>
42+
<dir>/path/to/cheatsheets/fonts/</dir>
43+
...
44+
</fontconfig>
45+
```
3346

3447

3548
2. You need to generate all the figures:

fonts/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.uuid

fonts/Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FONT_DIRS := delicious-123 roboto roboto-mono roboto-slab source-code-pro source-sans-pro source-serif-pro
2+
3+
DELICIOUS_ZIP := http://www.exljbris.com/dl/DELICIOUS_21_OTF.zip
4+
ROBOTO_ZIP := https://github.com/googlefonts/roboto/releases/download/v2.138/roboto-unhinted.zip
5+
ROBOTO_MONO_ZIP := https://github.com/googlefonts/RobotoMono/archive/8f651634e746da6df6c2c0be73255721d24f2372.zip
6+
ROBOTO_SLAB_ZIP := https://github.com/googlefonts/robotoslab/archive/a65e6d00d8e3e7ee2fabef844e58fa12690384d2.zip
7+
SOURCE_CODE_PRO_ZIP := https://github.com/adobe-fonts/source-code-pro/releases/download/2.038R-ro%2F1.058R-it%2F1.018R-VAR/OTF-source-code-pro-2.038R-ro-1.058R-it.zip
8+
SOURCE_SANS_PRO_ZIP := https://github.com/adobe-fonts/source-sans/releases/download/2.045R-ro%2F1.095R-it/source-sans-pro-2.045R-ro-1.095R-it.zip
9+
SOURCE_SERIF_PRO_ZIP := https://github.com/adobe-fonts/source-serif/releases/download/3.001R/source-serif-pro-3.001R.zip
10+
11+
UNZIP_FLAGS := -x "__MACOSX/*"
12+
13+
14+
.PHONY: default
15+
default: all
16+
17+
.PHONY: all
18+
all: sources
19+
mkdir -p $(FONT_DIRS)
20+
cd delicious-123 && unzip -j /tmp/delicious.zip "DELICIOUS_21_OTF/*.otf" $(UNZIP_FLAGS)
21+
cd delicious-123 && ln -sf Delicious_R_2021.otf Delicious-Roman.otf
22+
cd delicious-123 && ln -sf Delicious_SC_2021.otf Delicious-SmallCaps.otf
23+
cd roboto && unzip -j /tmp/roboto.zip "*.ttf" $(UNZIP_FLAGS)
24+
cd roboto-mono && unzip -j /tmp/roboto-mono.zip "RobotoMono-8f651634e746da6df6c2c0be73255721d24f2372/fonts/ttf/*.ttf" $(UNZIP_FLAGS)
25+
cd roboto-slab && unzip -j /tmp/roboto-slab.zip "robotoslab-a65e6d00d8e3e7ee2fabef844e58fa12690384d2/fonts/static/*.ttf" $(UNZIP_FLAGS)
26+
cd source-code-pro && unzip -j /tmp/source-code-pro.zip "*.otf" $(UNZIP_FLAGS)
27+
cd source-sans-pro && unzip -j /tmp/source-sans-pro.zip "source-sans-pro-2.045R-ro-1.095R-it/OTF/*.otf" $(UNZIP_FLAGS)
28+
cd source-serif-pro && unzip -j /tmp/source-serif-pro.zip "source-serif-pro-3.001R/OTF/*.otf" $(UNZIP_FLAGS)
29+
30+
.PHONY: sources
31+
sources:
32+
wget $(DELICIOUS_ZIP) -O /tmp/delicious.zip
33+
wget $(ROBOTO_ZIP) -O /tmp/roboto.zip
34+
wget $(ROBOTO_MONO_ZIP) -O /tmp/roboto-mono.zip
35+
wget $(ROBOTO_SLAB_ZIP) -O /tmp/roboto-slab.zip
36+
wget $(SOURCE_CODE_PRO_ZIP) -O /tmp/source-code-pro.zip
37+
wget $(SOURCE_SANS_PRO_ZIP) -O /tmp/source-sans-pro.zip
38+
wget $(SOURCE_SERIF_PRO_ZIP) -O /tmp/source-serif-pro.zip
39+
40+
.PHONY: clean
41+
clean:
42+
- rm $(HOME)/.cache/matplotlib/fontlist*
43+
- rm -rf $(FONT_DIRS)

handout-intermediate.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ \section*{\LARGE \rmfamily
7676
A matplotlib figure is composed of a hierarchy of elements that forms
7777
the actual figure. Each element can be modified. \medskip
7878

79-
\includegraphics[width=\linewidth]{anatomy-cropped.pdf}
79+
\includegraphics[width=\linewidth]{anatomy.pdf}
8080

8181
\subsection*{\rmfamily Figure, axes \& spines}
8282

handout-tips.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ \subsection*{\rmfamily Offline rendering}
121121

122122
% -----------------------------------------------------------------------------
123123
\subsection*{\rmfamily Range of continuous colors}
124+
124125
You can use colormap to pick from a range of continuous colors.
126+
125127
\begin{tabular}{@{}m{.774\linewidth}m{.216\linewidth}}
126128
\begin{lstlisting}[belowskip=-\baselineskip]
127129
X = np.random.randn(1000, 4)

requirements/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: default
2+
default: all
3+
4+
.PHONY: all
5+
all: requirements-base.txt requirements.txt
6+
7+
.PHONY: install
8+
install: requirements-base.txt requirements.txt
9+
pip-sync $^
10+
11+
requirements.txt: requirements-base.txt
12+
13+
%.txt: %.in
14+
pip-compile $<

requirements/requirements-base.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
numpy
2+
pip-tools

0 commit comments

Comments
 (0)