Skip to content

Commit

Permalink
📔 docs: auto generation (#784)
Browse files Browse the repository at this point in the history
* remove contributing guidelines duplicate

`docs/contributing.md` is now auto generated

* Commit Contributing Guidelines

* core `xtask` functionality

* almost there

* write panic

* almost almost there

* there.

* remove empty descriptions

* better contributing.md comment

* Commit Contributing Guidelines

* remove entries without descriptions

---------

Co-authored-by: adamperkowski <[email protected]>
  • Loading branch information
adamperkowski and adamperkowski authored Oct 8, 2024
1 parent e6172cc commit 01d571f
Show file tree
Hide file tree
Showing 12 changed files with 346 additions and 74 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
xtask = "run --package xtask --"
4 changes: 2 additions & 2 deletions .github/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nav:
- Introduction: 'index.md'
- User Guide: 'userguide.md'
- Contributing:
- Contributing Guide: 'contribute.md'
- Contributing Guide: 'contributing.md'
- Roadmap: 'roadmap.md'
- Documentation:
- Known Issues: 'KnownIssues.md'
Expand Down Expand Up @@ -86,4 +86,4 @@ plugins:
minify_html: true
htmlmin_opts:
remove_comments: true
cache_safe: true
cache_safe: true
11 changes: 11 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ jobs:
with:
fetch-depth: '0' # Fetch all commit history for all branches as well as tags.

- name: Copy Contributing Guidelines
run: |
echo "<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n$(cat .github/CONTRIBUTING.md)" > 'docs/contributing.md'
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Commit Contributing Guidelines
file_pattern: "docs/contributing.md"
add_options: '--force'
if: success()

- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/xtask.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: XTasks

on:
pull_request:
paths:
- "xtask"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo"
- "core/tabs"
push:
paths:
- "xtask"
- "Cargo.toml"
- "Cargo.lock"
- ".cargo"
- "core/tabs"

env:
CARGO_TERM_COLOR: always

jobs:
docgen:
name: DocGen
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-registry-

- name: Cache Cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-index-

- name: Run cargo xtask docgen
run: cargo xtask docgen

- name: Check uncommitted documentation changes
run: |
git diff
git diff-files --quiet \
|| (echo "Run 'cargo xtask docgen' and push the changes" \
&& exit 1)
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[workspace.package]
license = "MIT"
version = "24.9.28"
edition = "2021"

[workspace.dependencies]
ego-tree = "0.6.2"

[workspace]
members = ["tui", "core"]
members = ["tui", "core", "xtask"]
default-members = ["tui", "core"]
resolver = "2"

[patch.crates-io]
Expand Down
16 changes: 11 additions & 5 deletions docs/contribute.md → docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to Contribute?
<!-- THIS FILE IS GENERATED AUTOMATICALLY. EDIT .github/CONTRIBUTING.md -->\n\n# Contributing Guidelines for Linutil

Thank you for considering contributing to Linutil! We appreciate your effort in helping improve this project. To ensure that your contributions align with the goals and quality standards of Linutil, please follow these guidelines:

Expand Down Expand Up @@ -40,22 +40,28 @@ cd linutil
- **Make small, targeted PRs**: Focus on one feature or fix per pull request. This makes it easier to review and increases the likelihood of acceptance.
- **Avoid combining unrelated changes**: PRs that tackle multiple unrelated issues are harder to review and might be rejected because of a single problem.

## 8. Code Review and Feedback
## 8. Understand and Test the Code You Write

- **Review your code**: Before submitting your changes, take the time to review your code for readability, efficiency and performance. Consider how your changes affect the project.
- **Avoid using LLMs**: Don't submit AI-generated code without reviewing and testing it first. Ensure that any code you submit is thoroughly understood and meets the project's standards.
- **Testing Requirements**: Failure to conduct testing after multiple requests may result in the closure of your Pull Request.

## 9. Code Review and Feedback

- **Expect feedback**: PRs will undergo code review. Be open to feedback and willing to make adjustments as needed.
- **Participate in reviews**: If you feel comfortable, review other contributors' PRs as well. Peer review is a great way to learn and ensure high-quality contributions.

## 9. Contributing Is More Than Just Code
## 10. Contributing Is More Than Just Code

- **Test the tool**: Running tests and providing feedback on how the tool works in different environments is a valuable contribution.
- **Write well-formed issues**: Clearly describe bugs or problems you encounter, providing as much detail as possible, including steps to reproduce the issue.
- **Propose reasonable feature requests**: When suggesting new features, ensure they fit within the scope, style, and design of the project. Provide clear reasoning and use cases.

## 10. Documentation
## 11. Documentation

- **Update the documentation**: If your change affects the functionality, please update the relevant documentation files to reflect this.

## 11. License
## 12. License

- **Agree to the license**: By contributing to Linutil, you agree that your contributions will be licensed under the project's MIT license.

Expand Down
Loading

0 comments on commit 01d571f

Please sign in to comment.