Skip to content

Simplify doc management and update READMEs - #208

Merged
mxpv merged 3 commits into
containerd:mainfrom
mxpv:docs
Oct 4, 2023
Merged

Simplify doc management and update READMEs#208
mxpv merged 3 commits into
containerd:mainfrom
mxpv:docs

Conversation

@mxpv

@mxpv mxpv commented Sep 28, 2023

Copy link
Copy Markdown
Member

Currently we manage root documentation for each crate in 2 places: crate's README.md on Github and module's root documentation (comments that start with //!) that gets uploaded to docs.rs. Typically this is the same text that needs to be present in 2 places.

This PR aims to simplify this flow and uses README.md in both places, so there is no need to sync docs. When building, each crate will use include_str!="README.dm" macro to include the latest docs from the file.

I avoid extra work on local environments, this feature is hidden behind docs toggle, which is automatically enabled when building documentation for docs.rs.

@mxpv
mxpv requested a review from a team September 28, 2023 18:11
@github-actions github-actions Bot added T-docs Improvements or additions to documentation C-shim-protos Shim protos C-shim Containerd shim C-logging Shim logging C-client Containerd client C-snapshots Remote snapshotter C-runc runc helper labels Sep 28, 2023
@mxpv

mxpv commented Sep 28, 2023

Copy link
Copy Markdown
Member Author

Also as a side bonus, README examples are not compilable, which makes it easier to track outdated code.

@mxpv mxpv changed the title Simplify doc management Simplify doc management and update READMEs Sep 28, 2023
@jsturtevant

Copy link
Copy Markdown
Contributor

the failure is #207, should we disable that test to unblock the PR's? Not sure why it didn't seem to be an issue on #181

mxpv added 2 commits October 3, 2023 20:41
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>

@jsturtevant jsturtevant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked but I didn't see where the docs get compiled on a PR, is it cargo doc that passes the feature?

Comment thread crates/client/src/lib.rs
limitations under the License.
*/

#![cfg_attr(feature = "docs", doc = include_str!("../README.md"))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need the `//!`` so it formats properly?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can include markdown directly here.
You can verify the final result with:

cargo doc --no-deps --features docs --open

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@github-actions github-actions Bot added the T-CI Changes in project's CI label Oct 4, 2023
@mxpv

mxpv commented Oct 4, 2023

Copy link
Copy Markdown
Member Author

I looked but I didn't see where the docs get compiled on a PR, is it cargo doc that passes the feature?

I've updated CI to verify readmes with Github actions.

The docs feature is enabled when publishing to docs.rs via

[package.metadata.docs.rs]
 features = ["docs"]

@jsturtevant

Copy link
Copy Markdown
Contributor

LGTM

@mxpv
mxpv added this pull request to the merge queue Oct 4, 2023
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 4, 2023
@mxpv
mxpv merged commit a0e042a into containerd:main Oct 4, 2023
@mxpv
mxpv deleted the docs branch October 4, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-client Containerd client C-logging Shim logging C-runc runc helper C-shim Containerd shim C-shim-protos Shim protos C-snapshots Remote snapshotter T-CI Changes in project's CI T-docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants