Check docs in CI - #81
Conversation
kaze-cow
left a comment
There was a problem hiding this comment.
just minor things
Run just doc: it builds all workspace crates' docs and opens them in your browser. The generated HTML lives under target/doc/.
For me it didn't actually open my browser. I had to add --open to the underlying cargo doc command in order to do that. Maybe make it possible to specify additional varaidic arguments through Just?
Then, serve the content, for example:
Serving with a HTTP server really isn't necessary, can be loaded with command like
open target/doc/settlement_interface/index.html
| # Check that the documentation builds with no warnings, including private docs. | ||
| doc-check: | ||
| cargo doc --workspace --no-deps --all-features --document-private-items --config 'build.rustdocflags=["--deny=warnings"]' |
There was a problem hiding this comment.
this is less of a "doc-check" and more of a "doc-fullsince it primarily adds the private docs and makes warnings a failure. This means that the CI could end up having errors even if a dev just usedcargo doc` on their local machine
Maybe it would be best to just stick with one doc just command (the current doc-check)
If we do want to have a separate doc command for expected later public consumption, then maybe we should have just doc-prod or just doc-release
There was a problem hiding this comment.
Fair point. I still like the split and I think doc should still generate the main docs. What do you think about 63eb741 (basically keeping docs and renaming the check to doc-dev)?
Whoops. At first I added |
Make it so that the docs build and keep doing so without warnings.
More precisely:
justcommands,doc-devsanddoc, to generate respectively the dev docs (with aggressive linting) and public docs.Context
During an unrelated task, I've noticed that Claude encountered some issues when generating the docs.
Building the crate docs emitted rustdoc warnings, but nothing caught them:
just lintruns clippy (which doesn't touch rustdoc lints) and CI never built the docs at all. I want the docs to build cleanly and to stay that way.just doc-checkis appended tojust all(at the end), and a newdocsjob in.github/workflows/ci.ymlruns it on every push/PR.Both doc recipes use
--no-deps. This is because it makes both commands much faster: documenting the full dependency tree costs minutes in exchange for clickable external-type links in the full docs: nice but not worth the extra minutes imho.doc-devadditionally passes--document-private-itemsso it also checks internal docs;docleaves them out so the browsable output is a clean public view. Warnings are passed as errors in the check only.Generating and viewing the docs
Run
just doc: it builds all workspace crates' docs.You can pass in extra parameters, this is specifically intended to make it easier open the browser:
just doc --open. See relevantjustsyntax docs here.The generated HTML lives under
target/doc/.If you're running in a VM, you can serve the content, port-forward and take a look at them with your browser:
Click on the folder of each crate to see the docs (e.g., http://localhost:8000/settlement_interface/).
Doc build timings
Benchmark on my VM with:
--no-depsjust docjust doc-devA note on check-only mode
Ideally we'd have a recipe just for validating the docs without writing any HTML, but rustdoc's
--checkmode is gated behind-Z unstable-options(nightly).Testing
just doc-devpasses with zero warnings (previously 8).just docgenerates the docs.just allruns the full sweep including the newdoc-checkat the end.