Skip to content

site-build: build dp from the pool in CI, strict, with its execution report - #65

Merged
mmcky merged 4 commits into
mainfrom
site-build-dp
Nov 17, 2026
Merged

mmcky merged 4 commits into
mainfrom
site-build-dp

Conversation

@mmcky

@mmcky mmcky commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Builds dp from the pool in CI, the first site through the site-build workflow. For QuantEcon/project-monorepo#25 and the first form of QuantEcon/project-monorepo#77's workflow, which lives in this repository by the owner's decision of 2026-11-17.

The workflow, .github/workflows/site-build.yml

  • Matrix. tools/site-matrix reads sites/<key>/site.yml for each site in the workflow's SITES allowlist (today dp only) and emits the legs; runner gives runs-on and the container, cell_timeout the job's time limit. A GPU site is refused until its leg exists.
  • dp's leg, as lecture-dp builds itself: the container ghcr.io/quantecon/quantecon-build:latest (with packages: read), tools/sync dp for mirror/dp/environment.yml, the site's extra_packages installed with pip, actions/cache restored, tools/stage-site dp (the site's pages, _static, _config.yml and _toc.yml into lectures/), quantecon/actions/build-lectures@v0 (HTML, -n -W --keep-going, failure reports on), the execution report, the HTML and report uploaded, the cache saved, and the staged files removed whatever happened.
  • Cache. actions/cache at _build/jupyter_cache/<key>, keyed jb1-<key>-<hash of mirror/<key>/environment.yml>-<hash of extra_packages>-…. A pull request only restores; main saves after a green build that executed at least one page. The key does not catch a new :latest image or a new jax release, as dp's own cache does not.
  • Triggers. Push to main and pull requests touching lectures/**, sites/**, the tools it uses and sync/ inputs; manual; and Monday and Thursday at 05:17 UTC, so the cache is read before GitHub evicts it. Every pool or site change builds dp: warm once main has saved under the current key, cold (about 20 to 40 minutes) before that.
  • Nothing publishes. No deploy; that is QuantEcon/project-monorepo#78 and drift-check.yml: the refresh PR's own run waits for approval #27.

Supporting changes

  • tools/execution-report writes execution_status.json, one row per page: status, duration, kernel, executed or cached, and the error and traceback for a failed page. It reads myst-nb's own records from the Sphinx environment (what dp's status page shows), because the execution cache keeps no entry for a failed page.
  • tools/stage-site also stages the site's _config.yml and _toc.yml, so the build needs no --config or --toc, and build-lectures' error-output check reads the site's configuration for pages taken from the cache (53 of 53 checked locally, against 0 before).
  • site.yml gains an optional extra_packages. dp lists jax: its site adds intermediate's mccall_risk, which imports jax, and the lean image has none. On this CPU runner pip installs the CPU wheel. By the owner's decision of 2026-11-17 dp keeps its own environment, so its comparison with the live site stays clean. One environment for every site, with CPU and GPU variants, is the next step and gets its own design note.

Checked

  • 283 passed, 1 skipped; pool-check and the shared-asset index check clean; actionlint (with shellcheck) clean on every workflow.
  • Locally, outside the container: a cold strict build of dp's site from the pool exited 0 with no warnings in about 11 minutes (53 pages: 52 executed, 1 cached), and a warm rebuild took 9 s (53 cached). A planted failing cell fails the build and shows in the report. Two pool lectures sharing a label fail the strict build, which settles the label question carried to README: the pool, the tools and the plan as they are #25 from drift(dp-test): lectures/amss.md differs from its canonical copy in advanced #11.
  • An independent adversarial review found one blocker (no packages: read, so the image could not be pulled) and smaller points, all settled in the third commit.

This PR's own run is the first real test, in the container. Two things only main can show: the cache restoring on a second run (a pull request never saves), and the build on every push to main. So QuantEcon/project-monorepo#25 stays open until two runs on main after the merge. If the image pull is refused, QuantEcon/lectures needs adding to the package's Actions access list, which is an organisation setting.

Lecture content is unchanged: no file under lectures/ changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU

mmcky and others added 3 commits November 17, 2026 11:10
…report

The first form of the site-build workflow (QuantEcon/project-monorepo#77),
with dp as its first site (QuantEcon/project-monorepo#25).

- .github/workflows/site-build.yml: a matrix over the sites named in SITES
  (dp alone today), fail-fast off. Each leg runs in the container dp's own
  workflows use, reconstructs mirror/<key>/ for its environment.yml, restores
  the site's execution cache (actions/cache, jb1-<key>-<env hash>-<run>,
  restored by prefix, saved on main only after a green build that executed
  something), stages the site, builds HTML with QuantEcon/actions'
  build-lectures (absolute --toc and --config, -n -W --keep-going), writes
  the execution report, keeps the HTML and the report as artefacts, and
  unstages. Push to main and pull requests on the pool, the sites and the
  tools; manual; Monday and Thursday to keep the cache in use. It publishes
  nothing.
- tools/site-matrix: the matrix from each site's site.yml: runner class to
  runs-on and container, a job limit of cell_timeout plus 120 minutes; it
  refuses a runner class or site type that has no leg yet (the GPU class).
- tools/execution-report: execution_status.json, one row per page executed
  or taken from the cache (status, seconds, kernel, executed or cached), from
  myst-nb's records in Sphinx's environment.
- Tests for both tools on fixtures, and for the workflow's allowlist and its
  two path lists; sites/README.md and README.md describe the build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
…eeds no --config or --toc

build-lectures' check for error outputs reads _config.yml from its
source-dir. With the site's configuration passed as --config from sites/,
lectures/ held none, the check took myst-nb's defaults, and a page taken
from the execution cache went unchecked. tools/stage-site now copies the
site's _config.yml and _toc.yml into lectures/ with its pages (refusing if
either exists, recorded and removed by --clean like the rest), and
site-build.yml drops the absolute --toc and --config from extra-args.

Jupyter Book 1 finds both in the source folder by default, reads the
branding and the bibliography against lectures/ wherever the configuration
sits (Sphinx runs with noconfig, confdir the source folder), and passes
execute.cache straight to myst-nb, which reads it from the directory jb
runs in. tools/pool-check already fails a lectures/_config.yml or
lectures/_toc.yml as top-level; a test now says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
…a packages, and say what the cache can show

From the independent review of 5cee2e6 and 293ab3d.

- The build job has packages: read: quantecon-build is not public. The
  header says the package's Actions access list must include
  QuantEcon/lectures, which nothing here can check.
- site.yml gains an optional extra_packages, plain pip requirements
  (pool-check's site-yml rule and tools/site-matrix refuse anything that
  pip could read as an option). The leg installs them before the build,
  through env:, and the cache key carries their hash. dp's is [jax]: the
  image has none, and mccall_risk imports it without installing it (the
  owner's decision, 2026-11-17). drift-check's site-stale still skips
  site.yml; a test says so.
- tools/execution-report reads Sphinx's read times in seconds or in
  microseconds and, with --since, exits 2 on times that are neither,
  instead of reporting every page as cached.
- The workflow header and sites/README.md now say what the cache key does
  and does not catch, that every build is cold until main saves, that the
  restore can be shown only after the merge, what the concurrency group
  does on main, and that the failure artefact holds tracebacks, not the
  site's cache.
- tests.yml also runs on changes to site-build.yml and the sites' site.yml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
Copilot AI balanced review requested due to automatic review settings November 17, 2026 02:02

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.

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

A moderate-severity inconsistency was identified where tools/site-matrix permits explicitly empty or duplicate extra_packages entries that tools/pool-check rejects, potentially allowing invalid site.yml configurations to pass the site-build workflow unless validation is aligned.

1 open issue
What changed in this PR

Adds a new CI workflow to build the dp site from the pool (strict Jupyter Book build) in a container, with caching and an execution-status report artifact.

Changes:

  • Adds .github/workflows/site-build.yml to stage and build dp in CI with strict flags, restore/save execution cache, and upload HTML + execution report artifacts.
  • Introduces tools/site-matrix (derive workflow matrix legs from sites/<key>/site.yml) and tools/execution-report (emit execution_status.json from Sphinx/myst-nb execution metadata).
  • Updates staging and validation (tools/stage-site, tools/pool-check), extends site.yml with optional extra_packages, and expands documentation/tests accordingly.
File Description
tools/​tests/​test_sites.py Extends test coverage for site discovery/staging and site.yml validation, including _config.yml/_toc.yml and extra_packages handling.
tools/​tests/​test_site_matrix.py Adds tests validating tools/site-matrix matrix generation and workflow-path/behavior consistency.
tools/​tests/​test_execution_report.py Adds tests for tools/execution-report JSON output and edge cases across executed/cached/failed pages.
tools/​stage-site Updates site staging to copy book configuration files into lectures/ alongside the site content for builds.
tools/​site-matrix Introduces a tool that reads sites/<key>/site.yml and emits the CI matrix parameters for site builds.
tools/​pool-check Updates pool/site validation rules to support and validate optional extra_packages in site.yml.
tools/​execution-report Adds a tool that reads Sphinx/myst-nb execution records and produces an execution_status.json report plus step outputs.
sites/​README.md Documents site metadata (including extra_packages), staging expectations, and CI build/caching/report artifacts behavior.
sites/​dp/​site.yml Adds extra_packages: [jax] for dp to ensure required dependencies are available during CI builds.
README.md Updates repository documentation to reflect the new site-build workflow and supporting tooling.
.github/​workflows/​tests.yml Adjusts the test workflow to cover changes impacting the new site-build workflow and site metadata.
.github/​workflows/​site-build.yml Adds a containerized CI workflow that builds dp from the pool with strict settings, caching, and uploaded build/report artifacts.

Review effort: Balanced

Comment thread tools/site-matrix Outdated
Comment on lines +91 to +94
packages = data.get("extra_packages", [])
if not (isinstance(packages, list)
and all(isinstance(p, str) and REQUIREMENT_RE.fullmatch(p) for p in packages)):
return None, f"sites/{key}: extra_packages {packages!r} is not a list of pip requirements"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 44c5bb8: tools/site-matrix now applies pool-check's rule exactly. Absent means no extra packages; present means a non-empty list of plain requirements, each at most once. The test adds an empty list and a duplicate, both refused.

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.

2 participants