From b2bf54802036b55f4b1b9b72d0466be959d42568 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Thu, 30 Jul 2026 14:51:26 +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 The sphinx-tojupyter step is the first `jb build` in this workflow, and `execute_notebooks: "cache"` means only the first build executes notebooks — the later HTML build reads the cache. So this step is where a CellExecutionError surfaces, and it could not fail. It already carried `-n -W`, but that was inert: 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`, so a failing `jb build` was followed by `mkdir` and `cp`, and the step exited with `cp`'s status. `--keep-going` makes that worse rather than better, since it forces Sphinx to emit output despite the errors, guaranteeing the .ipynb files exist for `cp`. One line fixes it. The flags were already right. Refs QuantEcon/meta#340 Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16d9b15d..8a4f58aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,18 @@ jobs: - name: Build Download Notebooks (sphinx-tojupyter) shell: bash -l {0} run: | + # This is the FIRST `jb build` in the workflow, and `execute_notebooks: "cache"` + # means only the first build actually executes notebooks — the later HTML build + # reads 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 .ipynb files exist for `cp` + # to succeed on. + set -eo pipefail jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going mkdir -p _build/html/_notebooks cp -u _build/jupyter/*.ipynb _build/html/_notebooks