Skip to content

CI: align build safety with the English source repo (closes #184)#185

Merged
mmcky merged 3 commits into
mainfrom
ci/align-build-safety
Jul 20, 2026
Merged

CI: align build safety with the English source repo (closes #184)#185
mmcky merged 3 commits into
mainfrom
ci/align-build-safety

Conversation

@mmcky

@mmcky mmcky commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Resolves #184. Split out of #183 so that PR stayed scoped to content fixes.

Stacked on #183. The base is fix/182-execution-and-doc-failures, not main, so the diff here is just ci.yml and the CI run reflects reality — turning on -n -W against a main that still contains the four #182 defects would only re-report bugs #183 already fixes. GitHub will retarget this to main automatically when #183 merges.

What changes

Step Before After
Clear stale Sphinx environment absent (commented note only) added, matching source
Build Download Notebooks (sphinx-tojupyter) no flags -n -W --keep-going
Upload Execution Reports (Download Notebooks) absent added, if: failure()
Build HTML -n -W --keep-going unchanged
Build PDF from LaTeX commented out left alone — see below

The sphinx-tojupyter step is the substantive fix. It ran with no flags, so a notebook whose cells raised still exited zero and the job went green — that is how the two execution breaks in #182 (likelihood_bayes, kalman_2) reached main with passing CI.

The missing artifact upload compounded it: when that step did fail there was no traceback to read, which is why #182 had to be diagnosed from the weekly Build Cache workflow's artifact instead of from CI.

One non-obvious change

The HTML artifact is renamed execution-reportsexecution-reports-html. This is required, not cosmetic. upload-artifact@v7 runs with overwrite: false, so adding a second upload under the existing execution-reports name would collide whenever both steps fail in the same run. The new names follow the source repo's convention (-notebooks / -latex / -html).

Expect this to go red, and that is the point

Turning on -n -W surfaces every remaining latent failure at once, and there are very likely more than the four in #182. The Build Cache run that produced #182 is content-addressed: it re-executed only the lectures the resync wave changed, and reused old-environment cache for roughly 15 unchanged lectures that have never executed under anaconda 2026.07. Whatever this run reports is the real backlog.

The useful reading: a red run here is new information, not a regression. Work the list, then merge.

Verification

  • YAML parses; 13 steps.
  • Step-for-step parity against lecture-python.myst confirmed from Download "build" folder (cache) through Upload Execution Reports (Download Notebooks). Remaining divergence is the PDF/LaTeX pair and the source repo's GPU/JAX setup steps, neither of which applies here.
  • Both jb build invocations now carry -n -W --keep-going.

Left deliberately undone

The PDF/LaTeX build stays commented out. CJK under LaTeX is hard, and more so since #22 dropped text.usetex, so this looks like a considered choice rather than an oversight. It needs a human decision, not mechanical alignment — flagged in #184.

Related: QuantEcon/meta#340 tracks the same gap across the fleet (lecture-intro.zh-cn and the lecture-python-intro source repo have it too; lecture-python-programming is already aligned).

Closes #184

🤖 Generated with Claude Code

mmcky and others added 2 commits July 20, 2026 10:43
Resolves the four failures reported in #182. All four are target-side
defects; the English source is healthy in every case.

likelihood_bayes — the font block called `mpl.font_manager.fontManager`
and `plt.rcParams` before `import matplotlib.pyplot as plt`. Newer
matplotlib no longer imports `font_manager` as a side effect of
`import matplotlib`, so this raised AttributeError (and would have
raised NameError on `plt`). Moved the pyplot import above both uses.
An audit of the font block across all 69 lectures found this the only
file with either ordering hazard.

kalman_2 — a `.text()` annotation drew the covariance matrix with
`\begin{bmatrix}`, which matplotlib mathtext cannot render (it supports
no LaTeX environments). Rewritten as `\left[ \substack{...} \right]`,
which renders an equivalent bracketed 2x2 matrix under mathtext, using
`\;` as the column separator rather than `&`. This keeps the
drop-usetex standard from #22 intact with no loss of information.
The lecture's other `\begin{bmatrix}` uses are inside `{math}` blocks,
rendered by MathJax, and are unaffected.

sir_model — the header directive had lost its argument: `{raw}` instead
of `{raw} jupyter`. The other 50 lectures carrying this directive kept
theirs.

ak_aiyagari — the file carried a stray fence at line 38 followed by a
duplicated copy of the original frontmatter, and a doubled closing
fence at EOF. The stray opener ran to line 56, swallowing both the H1
title and the `_admonition/gpu.md` include, which is what produced the
13 "headings start at H2" warnings. Removed both strays; the file's
fence structure now matches the English source exactly (122). The
`translation.title` field was also corrupt ("V, σ, μ") and has been set
to the lecture title. An edition-wide sweep found no other file with
unbalanced fences.

The last two are content corruption introduced in translation and
warrant engine issues against action-translation; they are not covered
by the existing #107/#115/#116/#117 set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolves #184. Brings ci.yml's execution safety in line with
lecture-python.myst, which is the standard the fleet builds to.

- `-n -W --keep-going` on the sphinx-tojupyter build. Previously this
  step ran with no flags, so a notebook whose cells raised still exited
  zero and the job went green. That is how the two execution breaks in
  #182 (likelihood_bayes, kalman_2) reached main with passing CI.
- Upload Execution Reports (Download Notebooks), so a failure in that
  step leaves a traceback artifact. Previously there was none, which is
  why #182 had to be diagnosed from the weekly Build Cache workflow's
  artifact rather than from CI directly.
- Clear stale Sphinx environment (`rm -rf _build/.doctrees`) before the
  builds, matching the source repo. The equivalent was present here only
  as a commented-out note.

The HTML artifact is renamed `execution-reports` -> `execution-reports-html`.
This is required, not cosmetic: upload-artifact@v7 runs with
`overwrite: false`, so adding a second upload under the same name would
collide when both steps fail in one run. The new names match the source
repo's convention (-notebooks / -latex / -html).

The PDF/LaTeX build is left commented out — see the issue for why that
one needs a human decision rather than mechanical alignment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 02:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns this repo’s CI workflow with the upstream English source repository so notebook execution/build failures are surfaced reliably and produce actionable artifacts (as requested in #184).

Changes:

  • Clear Sphinx doctree cache before builds (rm -rf _build/.doctrees).
  • Run the sphinx-tojupyter build with -n -W --keep-going to fail on warnings/execution issues.
  • Upload execution report artifacts on failure, and rename the HTML report artifact to avoid name collisions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Base automatically changed from fix/182-execution-and-doc-failures to main July 20, 2026 03:19
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 20, 2026 03:27 Inactive
Addresses Copilot review feedback on #185.

`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,
which expands to `bash --noprofile --norc -eo pipefail {0}`. Without it,
this step's exit code is that of the trailing `cp`, so a failing
`jb build` was masked.

`--keep-going` made that worse rather than better: it forces Sphinx to
emit output despite the errors, so the .ipynb files exist, `cp` succeeds,
and the step goes green. The flag added in this PR to surface failures
was producing the artifacts that hid them.

Scope is exactly one step — an audit of ci.yml shows every other step is
either single-command (its exit code is the command's) or uses the
default shell, which does carry `-e`.

Note the English source repo lecture-python.myst has the byte-identical
pattern, so this is inherited from the standard rather than introduced
here, and it deviates from the strict parity this PR set out to
establish. Reported upstream so the standard can catch up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit 31c8082
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a5d9923c797820008258365
😎 Deploy Preview https://deploy-preview-185--astonishing-narwhal-a8fc64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
github-actions Bot temporarily deployed to pull request July 20, 2026 04:10 Inactive
@mmcky
mmcky merged commit 23c6245 into main Jul 20, 2026
7 checks passed
@mmcky
mmcky deleted the ci/align-build-safety branch July 20, 2026 05:18
mmcky added a commit to QuantEcon/lecture-intro.zh-cn that referenced this pull request Jul 20, 2026
…#270)

Ports QuantEcon/lecture-python.zh-cn#185 to this edition, closing the
QuantEcon/meta#340 gap here.

ci.yml
- `-n -W --keep-going` on the sphinx-tojupyter build. It previously ran
  with no flags, so a notebook whose cells raised still exited zero.
- `set -eo pipefail` in that same block. The flag alone is insufficient:
  `shell: bash -l {0}` is a custom shell spec, so GitHub injects no
  `-eo pipefail`, and the trailing mkdir/cp become the step's exit code.
  `--keep-going` makes it worse, guaranteeing the .ipynb files exist for
  `cp` to succeed on. Found by Copilot review on zh-cn#185.
- Upload Execution Reports (Download Notebooks), so a failure in that
  step leaves a traceback artifact.
- Clear stale Sphinx environment before the builds.
- HTML artifact renamed execution-reports -> execution-reports-html.
  Required, not cosmetic: upload-artifact runs with `overwrite: false`,
  so a second upload under the same name would collide when both steps
  fail in one run.

cache.yml
- `-W --keep-going` -> `-n -W --keep-going`, so the weekly cold build is
  strict on missing references as well as warnings, matching
  lecture-python.zh-cn.

ci-cn.yml is deliberately unchanged: it has no sphinx-tojupyter step and
its HTML build is a single command, so its exit code is already the
build's. That is why it — and not ci.yml — caught the prob_dist break
in #269.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align ci.yml build safety with the English source repo (-n -W on the notebook build, execution-report artifacts)

2 participants