ci(docs): publish docs/ to GitHub Pages with MkDocs Material - #289
Merged
Conversation
The docs are currently only readable as files. This builds them into a site and deploys it on push to main. MkDocs specifically, because every internal doc link is a relative .md path and README.md links into docs/index.md three times. MkDocs rewrites .md links to built URLs, so they keep working both on the site and in GitHub's blob view. Jekyll-from-/docs would 404 on all of them unless each were rewritten to .html, which would break GitHub browsing. A bare artifact upload would serve .md as plain text. strict: true is deliberate -- these docs cross-reference each other heavily, so a silent 404 is how the site rots. It paid for itself immediately: it caught getting_started.md linking ../README.md, which is outside docs_dir. That is now an absolute GitHub URL, so it resolves both on the site and on github.com. check-manifest runs in CI against the ignore list in pyproject.toml, and a new root mkdocs.yml would have failed package/verify. Added there and to MANIFEST.in alongside the existing Makefile exclusion. Actions pinned to full SHAs per the org policy in .github/dependabot.yml. Deliberately contains no reference to the auto-tune explainer in slaclab#288, so this can land independently. MkDocs copies non-markdown files from docs_dir into the site regardless of nav, so when slaclab#288 lands its index link resolves on the site with no change needed here -- verified by building with the explainer present and absent from nav.
🟢 PR size: 144 lines — within target
Target is 400 lines excluding tests, hard stop around 800 — see |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds MkDocs Material tooling and a GitHub Actions workflow to build the existing docs/ tree into a GitHub Pages site, keeping documentation readable both in-repo and as a rendered site.
Changes:
- Introduces
mkdocs.yml(MkDocs Material config) withstrict: trueand an explicit navigation structure. - Adds a
docsoptional dependency extra for local previews and adocsGitHub Actions workflow to build/deploy Pages fromdocs/. - Updates doc entry points/links (README and
docs/getting_started.md) to point to the deployed site and to avoid MkDocs strict link failures.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Links to the new GitHub Pages documentation site while preserving in-repo browsing via docs/. |
| pyproject.toml | Adds a docs extra for local MkDocs previewing; excludes mkdocs.yml from check-manifest. |
| mkdocs.yml | Configures MkDocs Material theme, extensions, strict link checking, and site nav. |
| MANIFEST.in | Excludes mkdocs.yml from the sdist to keep packaging output unchanged. |
| docs/getting_started.md | Replaces an out-of-docs_dir relative link with a resolvable GitHub URL under strict builds. |
| .github/workflows/docs.yml | Builds MkDocs on PRs/pushes and deploys to GitHub Pages on main (pinned action SHAs). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Builds
docs/into a documentation site with MkDocs Material and deploys it to GitHub Pages on push tomain. Today the docs are only readable as files in the repo.Independent of #288 — see Scope.
Operator-visible
None. Documentation tooling only — no PV writes, no application behavior changes, no launch changes.
mkdocs.ymlis excluded from both the sdist and the wheel, so nothing operators install changes.Scope
One commit, 6 files, +142/−2. No
src/changes, no test changes.Deliberately contains no reference to the auto-tune explainer in #288, so the two can land in either order. The coupling was only two lines — an
Explainersnav entry and adocs/index.mdrow — and both were removed here. MkDocs copies non-markdown files fromdocs_dirinto the site regardless ofnav, so when #288 lands its relative index link resolves on the site with no change needed tomkdocs.yml. Verified by building both ways: strict passes with the explainer absent, and with it present-but-not-in-nav (still copied byte-identical).Decisions worth recording
MkDocs rather than Jekyll-from-
/docs. Every internal doc link is a relative.mdpath (applications/tuning.md,utils/linac_model.md#pv-naming-conventions), andREADME.mdlinks intodocs/index.mdthree times. MkDocs rewrites.mdlinks to built URLs, so they keep working both on the site and in GitHub's blob view. Plain Jekyll would 404 on every one unless each were rewritten to.html, which breaks GitHub browsing. A bare artifact upload would serve.mdas plain text. MkDocs is the only option costing zero changes to existing content.strict: trueis deliberate. These docs cross-reference each other heavily, so a silent 404 is exactly how the site rots. It paid for itself immediately: it caughtdocs/getting_started.mdlinking../README.md, which is outsidedocs_dirand therefore unresolvable. That is now an absolute GitHub URL, which works both on the site and on github.com — the one content change in this PR.CI installs
mkdocs/mkdocs-materialdirectly rather than through the newdocsextra.pip install -e ".[docs]"would drag in PyQt5, pydm and pyepics to render markdown. The extra exists for local previews (mkdocs serve); the workflow keeps the two names in sync by hand. Noted in a comment indocs.yml.Actions pinned to full SHAs, per the org policy documented in
.github/dependabot.yml. Dependabot will bump them.Testing
mkdocs build --strict— exits 0, no warningscheck-manifest— passes, confirming the newmkdocs.ymlignore entry keepspackage / verifygreenpytest— 3137 passed, 3 skipped, unchangedblack(400 files) /flake8(0) cleanVerified by serving the built output locally:
/renders, every table link resolves,.mdlinks become directory URLs, and the anchorutils/linac_model/#pv-naming-conventionsis preserved.Before this takes effect
Pages must be switched to build from Actions — a repo setting, not part of the PR:
The
deployjob fails until that is done, and the newREADME.mdsite link 404s until the first deploy succeeds. Worth doing at merge time.