Skip to content

Commit 11122d7

Browse files
mmckyclaude
andauthored
CI: gate the first jb build so notebook errors cannot pass green (#588)
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) <noreply@anthropic.com>
1 parent b22983d commit 11122d7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ jobs:
5555
- name: Build Download Notebooks (sphinx-tojupyter)
5656
shell: bash -l {0}
5757
run: |
58+
# This is the FIRST `jb build` in the workflow, and `execute_notebooks: "cache"`
59+
# means only the first build actually executes notebooks — the later HTML build
60+
# reads the cache. So this is the step where a CellExecutionError surfaces, and
61+
# therefore the step that has to gate.
62+
#
63+
# `set -eo pipefail` is required as well as `-W`: `shell: bash -l {0}` is a
64+
# custom shell spec, so GitHub does not inject `-eo pipefail` (it only does
65+
# that for the bare `shell: bash` shorthand). Without it a failing `jb build`
66+
# would be masked by the trailing mkdir/cp, whose exit code becomes the
67+
# step's — and `--keep-going` guarantees the .ipynb files exist for `cp`
68+
# to succeed on.
69+
set -eo pipefail
5870
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
5971
mkdir -p _build/html/_notebooks
6072
cp -u _build/jupyter/*.ipynb _build/html/_notebooks

0 commit comments

Comments
 (0)