Files
Lawrence Angrave 8bf29081d3 Speed up CI: install only the texlive packages the book needs
The PDF job takes ~9 minutes and is the whole workflow's wall clock,
because install.sh pulls texlive-full: 455 packages and 4.0 GB of every
language pack, ConTeXt and Metapost. The book needs 68 packages,
768 MB.

Measured by building the book both ways in ubuntu:24.04 and comparing:

                 packages   download   apt install   make pdf
  texlive-full   455        3995 MB    270s          188s
  reduced set     68         768 MB     92s          141s

Output is equivalent, not merely similar: all 19 PDFs (main plus 18
chapters) have identical page counts (main.pdf is 390 pages either
way), identical page sizes, and byte-identical pdftotext output, with
no unresolved references in either.

Also:
- fail-fast: false, so a WIKI failure 90 seconds in stops cancelling
  the 9 minute PDF job. That happened repeatedly while fixing CI: the
  run then says nothing about whether the PDF is healthy.
- concurrency groups, asymmetric on purpose. PR builds have no side
  effects so a superseded run is cancelled. Deploy is NOT cancelled
  mid-run: it pushes the wiki, force-pushes epub_deploy and pdf_deploy
  and nudges the website, and interrupting that can leave the three
  targets on different commits.
- timeout-minutes: 30, so a hung link check cannot burn six hours.
- pip cache. Marginal - five small pure-python wheels - but free.

Note make -j4 was tried and rejected: it cuts the build to 80s but
produces a wrong book, numbering the appendix 13 instead of 17 and
degrading a cross-reference to ??.
2026-08-24 02:06:06 -05:00

52 lines
2.1 KiB
Bash

#!/bin/bash
set -o errexit
# Install packages that we need for python. Python3.6 is already installed
pip install -r requirements.txt
if test $BUILD_FOCUS = "WIKI" || test $BUILD_FOCUS = "EPUB"
then
# Install pandoc from source because Ubuntu is high outdated
pushd ~
wget https://github.com/jgm/pandoc/releases/download/2.7/pandoc-2.7-1-amd64.deb
sudo dpkg -i pandoc-2.7-1-amd64.deb
popd
fi;
if test $BUILD_FOCUS = "PDF"
then
# texlive-full drags in 455 packages / 4.0 GB -- every language pack,
# ConTeXt, Metapost, the lot -- and is the reason this job takes ~9
# minutes. The book needs 68 packages / 768 MB, listed below.
#
# Which package provides what (checked with apt-file on Ubuntu 24.04):
# latex-base book.cls fontenc geometry graphicx color hyperref
# natbib fancyhdr longtable grfext epstopdf-base
# latex-recommended microtype listings xcolor setspace float chapterbib
# latex-extra mdframed mfirstuc comment framed glossaries titlesec
# tocloft wrapfig changepage csquotes epigraph fncychap
# pictures pgffor
# fonts-recommended Charter type1 (bchr8a.pfb), Latin Modern
# fonts-extra mathdesign / mdbch. 614 MB of the 768 MB, so
# most of the remaining install time, but it is
# the only place mathdesign lives and it sets the
# book's body font. Dropping it changes every page.
# luatex lualatex, which the Makefile builds with
# font-utils epstopdf, for the 47 .eps drawings
# latexmk every build in the Makefile goes through latexmk
# ghostscript epstopdf's backend
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-pictures \
texlive-luatex \
texlive-font-utils \
latexmk \
ghostscript
fi;