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

[ci] make readme generation a just command #364

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
uses: taiki-e/install-action@8484225d9734e230a8bf38421a4ffec1cc249372 # v2
with:
tool: cargo-readme
- name: Run cargo readme
run: ./scripts/regenerate-readmes.sh
- name: Generate readmes
run: just generate-readmes
- name: Check for differences
run: git diff --exit-code
# cargo hack might cause changes to Cargo.lock which can cause the git diff above to fail. Put
Expand Down
13 changes: 13 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ rustdoc:
| gawk '{ gsub(" v", "@", $0); printf("%s\n", $1); }' \
| xargs printf -- '-p %s\n' \
| RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS='--cfg=doc_cfg' xargs cargo doc --no-deps --lib --all-features

# Generate README.md files from README.tpl and lib.rs files
generate-readmes:
#!/usr/bin/env bash
set -eo pipefail

git ls-files | grep README.tpl$ | while read -r readme; do
echo "Generating README for $readme"
dir=$(dirname "$readme")
cargo readme --project-root "$dir" > "$dir/README.md.tmp"
gawk -f "scripts/fix-readmes.awk" "$dir/README.md.tmp" > "$dir/README.md"
rm "$dir/README.md.tmp"
done
16 changes: 0 additions & 16 deletions scripts/regenerate-readmes.sh

This file was deleted.

Loading