CI for docs.rs build

With the imgui-rs project, we recently had a bunch of problems with releases not building docs,

  1. We added a features listing to [package.metadata.docs.rs] - but when this change was backported to previous release, we missed that one of the features was missing. This only errors when the release was published, so we had to make a new patch release just to fix the docs.rs build.
  2. Specifying our freetype feature in this package.metadata.docs.rs section uncovered another problem with our crate packaging

The latter problem is trickier to fix, and might take a few attempts - but we don't want to make a new patch release for every attempt

I'm wondering if there is a way to have the docs.rs build happen in a CI like fashion, where each commit is built?

I imagine the docs.rs infrastructure couldn't cope with building every projects docs on every commit, but I'm wondering if there is some common, more feasible, approach to this?

I don't know of a simple way to automatically interpret the package.metadata.docs.rs, but it's usually possible to come up with cargo invocations that manually pass the necessary arguments to do pretty much the same that docs.rs does. Unless... if you want to really do things "properly", you can run an actual docs.rs instance locally, which is also the only approach that docs.rs itself really describes:

https://docs.rs/about/builds#testing-builds-locally

Never tried that myself yet, no idea how large the overhead is or how this reports errors. Or how to set this up as CI (though note that I'm not really familiar with how to set up CI for anything so maybe that part is trivial?)

In Tokio we don't try to do this. We just have some tests of cargo doc with the same flags as what we told docs.rs to use.

I do the same in CI.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.