Repository navigation
site-build: build dp from the pool in CI, strict, with its execution report - #65
Conversation
…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
There was a problem hiding this comment.
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.ymlto stage and builddpin CI with strict flags, restore/save execution cache, and upload HTML + execution report artifacts. - Introduces
tools/site-matrix(derive workflow matrix legs fromsites/<key>/site.yml) andtools/execution-report(emitexecution_status.jsonfrom Sphinx/myst-nb execution metadata). - Updates staging and validation (
tools/stage-site,tools/pool-check), extendssite.ymlwith optionalextra_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
| 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" |
There was a problem hiding this comment.
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.
…each once Raised by Copilot on #65. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU

Builds
dpfrom 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.ymltools/site-matrixreadssites/<key>/site.ymlfor each site in the workflow'sSITESallowlist (todaydponly) and emits the legs;runnergivesruns-onand the container,cell_timeoutthe job's time limit. A GPU site is refused until its leg exists.ghcr.io/quantecon/quantecon-build:latest(withpackages: read),tools/sync dpformirror/dp/environment.yml, the site'sextra_packagesinstalled with pip,actions/cacherestored,tools/stage-site dp(the site's pages,_static,_config.ymland_toc.ymlintolectures/),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.actions/cacheat_build/jupyter_cache/<key>, keyedjb1-<key>-<hash of mirror/<key>/environment.yml>-<hash of extra_packages>-…. A pull request only restores;mainsaves after a green build that executed at least one page. The key does not catch a new:latestimage or a new jax release, as dp's own cache does not.mainand pull requests touchinglectures/**,sites/**, the tools it uses andsync/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 oncemainhas saved under the current key, cold (about 20 to 40 minutes) before that.Supporting changes
tools/execution-reportwritesexecution_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-sitealso stages the site's_config.ymland_toc.yml, so the build needs no--configor--toc, andbuild-lectures' error-output check reads the site's configuration for pages taken from the cache (53 of 53 checked locally, against 0 before).site.ymlgains an optionalextra_packages. dp listsjax: its site adds intermediate'smccall_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
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
maincan show: the cache restoring on a second run (a pull request never saves), and the build on every push tomain. So QuantEcon/project-monorepo#25 stays open until two runs onmainafter 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