chore(ci): add check for keeping README.md up-to-date (#1473)

This commit is contained in:
Orhun Parmaksız 2024-11-07 09:45:14 +03:00 committed by GitHub
parent 98df774d7f
commit e5e2316451
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 4 deletions

View file

@ -116,6 +116,16 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo xtask check
# Check if README.md is up-to-date with the crate's documentation.
check-readme:
name: Check README
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-rdme
- run: cargo xtask check-readme
# Run cargo rustdoc with the same options that would be used by docs.rs, taking into account the
# package.metadata.docs.rs configured in Cargo.toml. https://github.com/dtolnay/cargo-docs-rs
lint-docs:

View file

@ -151,7 +151,7 @@ are drawn to the terminal. See the [Widgets] section of the [Ratatui Website] fo
The closure passed to the [`Terminal::draw`] method should handle the rendering of a full frame.
```rust
use ratatui::{Frame, widgets::Paragraph};
use ratatui::{widgets::Paragraph, Frame};
fn run(terminal: &mut ratatui::DefaultTerminal) -> std::io::Result<()> {
loop {
@ -209,7 +209,7 @@ use ratatui::{
fn draw(frame: &mut Frame) {
use Constraint::{Fill, Length, Min};
let vertical = Layout::vertical([Length(1), Min(0),Length(1)]);
let vertical = Layout::vertical([Length(1), Min(0), Length(1)]);
let [title_area, main_area, status_area] = vertical.areas(frame.area());
let horizontal = Layout::horizontal([Fill(1); 2]);
let [left_area, right_area] = horizontal.areas(main_area);
@ -293,7 +293,7 @@ fn draw(frame: &mut Frame) {
[Layout]: https://ratatui.rs/how-to/layout/
[Styling Text]: https://ratatui.rs/how-to/render/style-text/
[templates]: https://github.com/ratatui/templates/
[Examples]: https://github.com/ratatui/ratatui/blob/main/ratatui/examples/README.md
[Examples]: https://github.com/ratatui/ratatui/tree/main/examples/README.md
[Report a bug]: https://github.com/ratatui/ratatui/issues/new?labels=bug&projects=&template=bug_report.md
[Request a Feature]: https://github.com/ratatui/ratatui/issues/new?labels=enhancement&projects=&template=feature_request.md
[Create a Pull Request]: https://github.com/ratatui/ratatui/compare

View file

@ -5,13 +5,13 @@ description = """
Widget libraries should use this crate. Applications should use the main Ratatui crate.
"""
version = "0.3.0"
readme = "README.md"
authors.workspace = true
documentation.workspace = true
repository.workspace = true
homepage.workspace = true
keywords.workspace = true
categories.workspace = true
readme.workspace = true
license.workspace = true
exclude.workspace = true
edition.workspace = true

View file

@ -59,6 +59,10 @@ enum Command {
#[command(visible_alias = "c")]
Check,
/// Check if README.md is up-to-date
#[command(visible_alias = "cr")]
CheckReadme,
/// Generate code coverage report
#[command(visible_alias = "cov")]
Coverage,
@ -129,6 +133,7 @@ impl Command {
Command::CI => ci(),
Command::Build => build(),
Command::Check => check(),
Command::CheckReadme => check_readme(),
Command::Coverage => coverage(),
Command::Lint => lint(),
Command::LintClippy => lint_clippy(),
@ -165,6 +170,11 @@ fn check() -> Result<()> {
run_cargo(vec!["check", "--all-targets", "--all-features"])
}
/// Run cargo-rdme to check if README.md is up-to-date with the library documentation
fn check_readme() -> Result<()> {
run_cargo(vec!["rdme", "--workspace-project", "ratatui", "--check"])
}
/// Generate code coverage report
fn coverage() -> Result<()> {
run_cargo(vec![