-
Notifications
You must be signed in to change notification settings - Fork 1
feat: use just for quickly run tasks. #34
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,45 @@ | ||
| # libchat | ||
| Supporting library for Logos-chat | ||
|
|
||
| Supporting library for Logos-chat. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Install Rust via [rustup](https://rust-lang.org/tools/install/): | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Using Cargo | ||
|
|
||
| ```bash | ||
| # Build | ||
| cargo build | ||
|
|
||
| # Run tests | ||
| cargo test | ||
|
|
||
| # Run examples | ||
| cargo run --example double_ratchet_basic | ||
| ``` | ||
|
|
||
| ### Using Just | ||
|
|
||
| Install [just](https://github.com/casey/just) to manage complex tasks. | ||
|
|
||
| On MacOS, you can install it via Homebrew: | ||
|
|
||
| ```bash | ||
| brew install just | ||
| ``` | ||
|
|
||
| After that, run: | ||
|
|
||
| ```bash | ||
| # Build | ||
| just build | ||
|
|
||
| # Run tests | ||
| just test | ||
|
|
||
| # Run all examples | ||
| just run-examples | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # The first receipt is the default task, run with `just` | ||
| build: | ||
| cargo build | ||
|
|
||
| test: | ||
| cargo test | ||
|
|
||
| # Run all examples | ||
| run-examples: | ||
| cargo run --example double_ratchet_basic | ||
| cargo run --example serialization_demo | ||
| cargo run --example storage_demo | ||
| cargo run --example out_of_order_demo | ||
|
Comment on lines
+9
to
+13
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these examples are hidden behind feature flags. If we want people to be able to run examples easily then it would make sense to remove the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually valuable? How often does someone want to run all the examples at once?
This seems like it is trying to perform the same job as integration tests.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I run this command for the PRs I made after this change, before I was running such demos one by one, and easily forgot one and introduce bug.
In my previous experience, I see a lot of failing demos or even no demos in some of logos messaging repos, I want to avoid such scenarios happened in libchat.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
However if the goal is to ensure that demo code isn't broken, then it should be ensured via CI and tests.
Add tests that ensure specific behaviour you are looking for and then add
cargo test --examplesto ensure they meet the expected results.Simply executing the examples doesn't ensure they are operating correctly.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, CI will be added later.
Tests is not clearly show the workflow like demos, that's why most rust libraries contains examples directory, which is good in may ways.
Running examples ensures it successful, without such helper, it will be hard to check all the examples easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also updated the readme to indicate just is not mandatory, and using Cargo as an option to get started.