Skip to content

ci: Documentation generation with doc-gen4 - #34

Merged
SnO2WMaN merged 6 commits into
mainfrom
ci/add-documentation
Aug 19, 2026
Merged

ci: Documentation generation with doc-gen4#34
SnO2WMaN merged 6 commits into
mainfrom
ci/add-documentation

Conversation

@SnO2WMaN

@SnO2WMaN SnO2WMaN commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

Re-adds doc-gen4 documentation generation to CI, previously merged in #1 and reverted in #4 because the docs build broke CI.

The setup now matches Foundation, where the same thing has been passing all along:

  • lake build ProvabilityLogic:docs as a step of the build job.
  • .lake/build/doc added to the uploaded lean-artifacts.
  • cp -r .lake/build/doc pages/docs on deploy.
  • README link to the generated documentation.

The docs step runs after lake pack/Save project cache (the one deviation from Foundation), so the cached archive doesn't carry doc-gen4's HTML output.

Why #1 broke, and what actually fixes it

The failure was resource exhausted (error code: 12, cannot allocate memory), but only on the <pkg>:srcUri.github targets — every docInfo target succeeded. So the Lean work itself fit fine; what failed was fork(). doc-gen4 holds the whole environment in one process and forks a git child per package to resolve source URIs, many at once under lake's parallelism, and the kernel's overcommit heuristic refused forks that large.

That turned out to be specific to the ubuntu-26.04 runner pin. Foundation builds its docs on ubuntu-latest and never hits it. Moving the Lean jobs to ubuntu-latest fixes the docs build on its own, with no workaround step, so the pin is dropped.

Verified by CI on this branch:

run runner extra step Build docs
32191304565 ubuntu-26.04 none srcUri ENOMEM
32192392047 ubuntu-26.04 overcommit + swap
32194680322 ubuntu-26.04 overcommit only
32196695941 ubuntu-latest none ✅ 4420 jobs

🤖 This PR was written with the assistance of Claude Code.

Test plan

SnO2WMaN and others added 6 commits August 19, 2026 06:48
Re-add doc-gen4 documentation generation, previously reverted in #4 after
`lake build ProvabilityLogic:docs` OOM'd building `coreDocs` and every
subsequently forked process failed with ENOMEM.

This time the docs build lives in its own job (isolated from `build`,
`check-references`, `mk-all-check` so a slow/flaky docs build can't take
those down too), gets extra swap for headroom against doc-gen4's memory
spike, and only runs on pushes to main or manual dispatch rather than every
PR. `deploy` treats it as a soft dependency: a failed docs job no longer
blocks the rest of the pages site from deploying.

Co-Authored-By: Claude <noreply@anthropic.com>
The runner image already ships an active /swapfile, so fallocate on that
path failed with "Text file busy". Add extra swap under a different name
instead.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the separate swap-provisioned docs job with the layout Foundation
uses and that passes there: `lake build <lib>:docs` as a step of the build
job, `.lake/build/doc` in the uploaded artifacts, and `cp -r` into
pages/docs on deploy.

The docs step runs after the project cache is packed so the cache archive
does not carry doc-gen4's HTML output.

Co-Authored-By: Claude <noreply@anthropic.com>
The docs build failed with "resource exhausted (error code: 12, cannot
allocate memory)" on every `<pkg>:srcUri.github` target while every
`docInfo` target succeeded, so the Lean work itself fits: what fails is
fork(). doc-gen4 holds the whole Mathlib+Foundation environment in one
process and forks a git child per package, and the kernel's default
overcommit heuristic refuses a fork that large.

Set vm.overcommit_memory=1 so the copy-on-write forks are allowed, and add
swap for headroom at the peak.

Co-Authored-By: Claude <noreply@anthropic.com>
Every `docInfo` target succeeded even when the build failed, so RAM was
never the constraint and the swap was a leftover from the initial
misdiagnosis. Only the overcommit setting addresses the actual failure,
which is fork() being refused.

Co-Authored-By: Claude <noreply@anthropic.com>
Test whether matching Foundation's runner removes the need for the
overcommit workaround: the docs build failed only on ubuntu-26.04, and
Foundation builds its own docs on ubuntu-latest with no such step.

Drops the overcommit step along with the pin.

Co-Authored-By: Claude <noreply@anthropic.com>
@SnO2WMaN SnO2WMaN changed the title ci: add documentation ci: Documentation generation with doc-gen4 Aug 18, 2026
@SnO2WMaN
SnO2WMaN added this pull request to the merge queue Aug 19, 2026
Merged via the queue into main with commit 9b295e6 Aug 19, 2026
5 checks passed
@SnO2WMaN
SnO2WMaN deleted the ci/add-documentation branch August 19, 2026 00:34
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.

1 participant