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

chore: CI speedups #89

Merged
merged 5 commits into from
Feb 5, 2025
Merged

chore: CI speedups #89

merged 5 commits into from
Feb 5, 2025

Conversation

jeluard
Copy link
Contributor

@jeluard jeluard commented Feb 4, 2025

Some CI improvements:

  • only run target specifics per target (i.e. run fmt only once)
  • lib only target (e.g. wasm) do not run on final amaru CLI (only amaru-ledger)

Summary by CodeRabbit

  • Chores
    • Refined test commands to focus on workspace-based and feature-specific testing.
    • Enhanced the continuous integration process with new quality checks for code formatting and linting.
    • Added new jobs for building crates and performing sanity checks, improving overall workflow reliability.

Copy link

coderabbitai bot commented Feb 4, 2025

Warning

Rate limit exceeded

@jeluard has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 14 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

Reviewing files that changed from the base of the PR and between 20d1fb4 and 5991914.

📒 Files selected for processing (1)
  • .github/workflows/CI.yml (2 hunks)

Walkthrough

The changes update the testing command and the CI workflow configuration. In the .cargo/config.toml file, the test-amaru alias has been modified to remove the --all-targets option. Meanwhile, the .github/workflows/CI.yml file now includes two new jobs: a sanity job for checking code formatting and linting, and a build-crates job for building crates targeting wasm32-unknown-unknown. The existing build job has been adjusted to depend on the successful execution of the sanity job.

Changes

File(s) Change Summary
.cargo/config.toml Modified the test-amaru alias: removed the --all-targets option, leaving only --workspace and --all-features on the command line.
.github/workflows/CI.yml Added a new sanity job for formatting and linting; added a build-crates job for WASM target builds; modified the build job to depend on sanity.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CI as CI Pipeline
    participant Sanity as Sanity Job
    participant Build as Build Job
    participant BuildCrates as Build-Crates Job

    Dev->>CI: Push commit
    CI->>Sanity: Execute sanity job\n(check formatting & linting)
    Sanity-->>CI: Report success/failure
    CI->>Build: Run build job (if sanity successful)
    CI->>BuildCrates: Run build-crates job (if sanity successful)
Loading

Suggested reviewers

  • wolf31o2

Poem

In the realm of code and CI flair,
A test alias now dances with lighter air.
Sanity checks pave the builder’s way,
While WASM crates join the fray.
Cheers to a pipeline smooth as a sunny day!
🎉🚀 Happy coding, mate!


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using 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 do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@jeluard
Copy link
Contributor Author

jeluard commented Feb 4, 2025

Compilation failure of the musl target is addressed in #90

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: 0

🧹 Nitpick comments (2)
.github/workflows/CI.yml (2)

20-32: Spiffing new ‘sanity’ job for speedy formatting and linting checks
Adding a dedicated job for checking code format and running clippy is a clever move! This should help cut down on redundancy and speed up the CI process. It's also spot on with a 30-minute timeout, which seems plenty for these tasks.


45-48: Noted Disabled Musl Target – A word to the wise
The musl target remains commented out. While it's fine to keep temporarily, consider either a brief comment outlining when to re-enable it or a cleanup if it's redundant. It helps avoid later confusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6169df and 20d1fb4.

📒 Files selected for processing (1)
  • .github/workflows/CI.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: sanity
🔇 Additional comments (2)
.github/workflows/CI.yml (2)

34-34: Chaining dependencies with ‘needs: sanity’ – Cheers for that
Requiring the ‘sanity’ job before kicking off the main build is a top-notch strategy to ensure only well-formatted and linter-passed code makes it to further stages. This dependency chaining is as sound as a pound, mate!


68-100: Brilliant addition of the ‘build-crates’ job for wasm builds
This new job focusing on building crates for the wasm32-unknown-unknown target is an ace addition. The optional test execution and the warning mechanism on failure look well-thought-out—ensuring that a hiccup in these niche tests doesn't derail the whole build. Just double-check that the use of cargo test (instead of the modified alias used elsewhere) is intentional for the selected package.

@jeluard
Copy link
Contributor Author

jeluard commented Feb 5, 2025

musl target has been disabled for now has it's been broken for some days (unrelated to this PR). It was silently broken because it was incorrectly set optional. I couldn't find the reason of this regression yet.

@jeluard jeluard requested a review from KtorZ February 5, 2025 07:11
.github/workflows/CI.yml Outdated Show resolved Hide resolved
Comment on lines 68 to 90
build-crates:
name: Build crates on ${{ matrix.environments.runner }} with target ${{ matrix.environments.target }}
needs: sanity
strategy:
fail-fast: false
matrix:
environments:
- runner: ubuntu-latest
target: wasm32-unknown-unknown
package: amaru-ledger
optional: true
timeout-minutes: 30
runs-on: ${{ matrix.environments.runner }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ runner.os }}-${{ matrix.environments.target }}
- run: rustup target add ${{ matrix.environments.target }}
- name: Run tests
run: |
set +e
cargo test --locked --all-features -p ${{ matrix.environments.package }} --target ${{ matrix.environments.target }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure I follow here? Why build the ledger separately from the rest (and has a separate job altogether)? Couldn't the same be achieved by adding packages to the matrix in the previous job? And more importantly, would the previous job already build and test the ledger crate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ledger would indeed be tested by the previous job but some target (e.g. wasm) won't realistically compile the full amaru, failing the whole job. So the idea is to restrict to some identified packages those specific targets.

I can see if there is some way to combine both.

@jeluard jeluard requested a review from KtorZ February 5, 2025 14:07
@KtorZ KtorZ merged commit 2dc402b into main Feb 5, 2025
7 checks passed
@KtorZ KtorZ deleted the jeluard/ci-crates branch February 5, 2025 16:07
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.

2 participants