Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify doc management and update READMEs #208

Merged
merged 3 commits into from
Oct 4, 2023
Merged

Conversation

mxpv
Copy link
Member

@mxpv mxpv commented Sep 28, 2023

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
Copy link
Member Author

mxpv commented Sep 28, 2023

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
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

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Copy link
Contributor

@jsturtevant jsturtevant left a comment

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?

@@ -14,12 +14,11 @@
limitations under the License.
*/

#![cfg_attr(feature = "docs", doc = include_str!("../README.md"))]
Copy link
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
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
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
Copy link
Member Author

mxpv commented Oct 4, 2023

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
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
15 checks passed
@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