From 0114165e1576f3ef8e9c1a83adfa5d4ef4fdb32c Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Thu, 30 Jul 2026 14:53:05 +1000 Subject: [PATCH] CI: gate the first jb build so notebook errors cannot pass green MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Build PDF from LaTeX" is the first `jb build` in this workflow, and `execute_notebooks: "cache"` means only the first build executes notebooks — the later tojupyter and HTML builds read the cache. So this step is where a CellExecutionError surfaces, and it could not fail. Two defects, both fixed here: - it ran with `-n --keep-going` and no `-W`, so a CellExecutionError was a non-fatal warning - its exit code was `cp`'s, not `jb build`'s. The step runs three commands under `shell: bash -l {0}`, and GitHub only injects `-eo pipefail` for the bare `shell: bash` shorthand; an explicit custom shell spec gets neither `-e` nor `-o pipefail`. `--keep-going` compounds it by guaranteeing the PDF exists for `cp` to succeed on Checked before making the change: this repo has no `raises-exception` tags, and all 64 published lecture pages render without execution-error output. Refs QuantEcon/meta#340 Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb32c127..3f6c3afe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,18 @@ jobs: - name: Build PDF from LaTeX shell: bash -l {0} run: | - jb build lectures --builder pdflatex --path-output ./ -n --keep-going + # This is the FIRST `jb build` in the workflow, and `execute_notebooks: "cache"` + # means only the first build actually executes notebooks — the later + # tojupyter and HTML builds read the cache. So this is the step where a + # CellExecutionError surfaces, and therefore the step that has to gate. + # + # `set -eo pipefail` is required as well as `-W`: `shell: bash -l {0}` is a + # custom shell spec, so GitHub does not inject `-eo pipefail` (it only does + # that for the bare `shell: bash` shorthand). Without it a failing `jb build` + # would be masked by the trailing mkdir/cp, whose exit code becomes the + # step's — and `--keep-going` guarantees the PDF exists for `cp` to succeed on. + set -eo pipefail + jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going mkdir -p _build/html/_pdf cp -u _build/latex/*.pdf _build/html/_pdf - name: Build Download Notebooks (sphinx-tojupyter)