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

Improved CI ⏩ #11

Merged
merged 5 commits into from
May 27, 2024
Merged

Improved CI ⏩ #11

merged 5 commits into from
May 27, 2024

Conversation

Bullrich
Copy link
Owner

@Bullrich Bullrich commented May 27, 2024

  • Added benchmarks with the library divan
  • Added more steps to the required tests

Summary by CodeRabbit

  • New Features

    • Introduced benchmarking for input/output handling and logging to improve performance insights.
  • Chores

    • Added divan dependency for benchmarking.
    • Updated build workflow to include new benchmark steps.

By using the library [divan](https://crates.io/crates/divan)

Added the bench command to the required tests
@Bullrich Bullrich self-assigned this May 27, 2024
Copy link

coderabbitai bot commented May 27, 2024

Warning

Rate Limit Exceeded

@Bullrich has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 54 minutes and 28 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 56704af and da0dee7.

Walkthrough

The recent changes introduce a new benchmarking capability using the divan framework to the project. This includes updates to the GitHub Actions workflow for testing, the addition of a new dependency in Cargo.toml, and the creation of a new benchmarking file for measuring the performance of various input/output and logging actions.

Changes

Files Change Summary
.github/workflows/test.yml Introduced additional build and benchmark steps alongside existing steps for clippy, documentation, and testing.
Cargo.toml Added divan as a dev-dependency and configured a benchmark for action_speed.
benches/action_speed.rs Introduced benchmarking functions for input/output handling and logging using the divan framework.

Poem

In the code, a new dawn breaks,
With benchmarks set for speed's sake.
Divan joins the dev parade,
Ensuring actions don't degrade.
Clippy, docs, and tests align,
In workflows, all steps combine.
Speed and grace, in code we trust,
Performance gains are now a must. 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to full the review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between a591027 and 56704af.
Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (3)
  • .github/workflows/test.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • benches/action_speed.rs (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/test.yml
Additional comments not posted (4)
Cargo.toml (2)

22-24: The benchmark configuration with harness = false is appropriate for custom benchmark setups.


20-20: Ensure divan version "0.1.14" is the latest or a stable version to avoid potential issues.

Verification successful

The version "0.1.14" specified for the divan dependency is the latest available on crates.io.

  • Cargo.toml: Line 20
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check the latest version of `divan` on crates.io

curl https://crates.io/api/v1/crates/divan | jq '.crate.max_version'

Length of output: 394

benches/action_speed.rs (2)

19-23: Add a comment explaining the intent behind expecting an error for these inputs.


33-40: Ensure that the log levels are appropriately set and tested in this benchmark.

Verification successful

The implementations of the logging functions in src/logger.rs confirm that the log levels are appropriately set:

  • debug_log formats the message with a ::debug:: prefix.
  • info writes the message to stdout.
  • warn_log, error_log, and notice_log use the issue_command function with the respective log levels.

This ensures that the log levels are correctly set and tested in the log_benchmark function.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify log levels are set correctly in the benchmark.

grep -r "log_level" src/

Length of output: 24



Script:

#!/bin/bash
# Find the implementation of the `debug_log` function
ast-grep --lang rust --pattern 'fn debug_log($_) { $$$ }'

# Find the implementation of the `info` function
ast-grep --lang rust --pattern 'fn info($_) { $$$ }'

# Find the implementation of the `warn_log` function
ast-grep --lang rust --pattern 'fn warn_log($_) { $$$ }'

# Find the implementation of the `error_log` function
ast-grep --lang rust --pattern 'fn error_log($_) { $$$ }'

# Find the implementation of the `notice_log` function
ast-grep --lang rust --pattern 'fn notice_log($_) { $$$ }'

Length of output: 294



Script:

#!/bin/bash
# Find the implementation of the `debug_log` function
rg 'fn debug_log'

# Find the implementation of the `info` function
rg 'fn info'

# Find the implementation of the `warn_log` function
rg 'fn warn_log'

# Find the implementation of the `error_log` function
rg 'fn error_log'

# Find the implementation of the `notice_log` function
rg 'fn notice_log'

Length of output: 309



Script:

#!/bin/bash
# Extract the implementation of the `debug_log` function
sed -n '/pub fn debug_log/,/}/p' src/logger.rs

# Extract the implementation of the `info` function
sed -n '/pub fn info/,/}/p' src/logger.rs

# Extract the implementation of the `warn_log` function
sed -n '/pub fn warn_log/,/}/p' src/logger.rs

# Extract the implementation of the `error_log` function
sed -n '/pub fn error_log/,/}/p' src/logger.rs

# Extract the implementation of the `notice_log` function
sed -n '/pub fn notice_log/,/}/p' src/logger.rs

Length of output: 661

Comment on lines +11 to +15
fn set_output_benchmark(value: &str) {
match set_output("name", value) {
Ok(_) => {}
Err(err) => panic!("{:#?}", err),
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider handling errors more gracefully in benchmarks instead of using panic!.

match set_output("name", value) {
    Ok(_) => {},
    Err(err) => eprintln!("Error: {:#?}", err),
}

Comment on lines +27 to +30
fn get_debug_benchmark() {
if !is_debug() {
panic!("It should be debug")
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a less disruptive approach than panic! for handling the debug mode check in benchmarks.

if !is_debug() {
    eprintln!("Debug mode should be active.");
}

@Bullrich Bullrich enabled auto-merge (squash) May 27, 2024 13:42
@Bullrich Bullrich merged commit 133bcfd into main May 27, 2024
8 checks passed
@Bullrich Bullrich deleted the ci/improvements branch May 27, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant