Skip to content

ci: Use parallelized clang-tidy task from yscope-dev-utils. - #97

Merged
sitaowang1998 merged 2 commits into
y-scope:mainfrom
sitaowang1998:parallel_clang_tidy
Apr 5, 2025
Merged

ci: Use parallelized clang-tidy task from yscope-dev-utils.#97
sitaowang1998 merged 2 commits into
y-scope:mainfrom
sitaowang1998:parallel_clang_tidy

Conversation

@sitaowang1998

@sitaowang1998 sitaowang1998 commented Apr 5, 2025

Copy link
Copy Markdown
Collaborator

Description

Currently a run of clang-tidy on all files take at least 70 minutes in GitHub workflow. This pr change the lint task file to use the parallelized clang-tidy provided by latest yscope-dev-utils.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • GitHub workflows pass

Summary by CodeRabbit

  • Chores
    • Enhanced internal quality assurance by optimising concurrent execution to better utilise system resources.
    • Streamlined configuration of automated inspections to improve overall efficiency and performance.

@sitaowang1998
sitaowang1998 requested a review from a team as a code owner April 5, 2025 00:43
@coderabbitai

coderabbitai Bot commented Apr 5, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request modifies two configuration files related to linting. The GitHub Actions workflow now runs the lint command with the -C $(nproc) option, allowing it to use multiple CPU cores. Additionally, in the lint-tasks configuration, the cpp-static-check task has been revised to use a shared anchor for source file paths and to replace multiple clang-tidy invocations with a consolidated task that accepts restructured parameters.

Changes

File(s) Change Summary
.github/workflows/code-linting-checks.yaml Updated the linting command from task lint:check to task lint:check -C $(nproc), enabling the lint process to utilise multiple CPU cores.
lint-tasks.yaml Revised the cpp-static-check task: replaced explicit sources with a shared anchor (*cpp_source_files) and consolidated several clang-tidy commands into a single task with new variables.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant LintJob as Lint Job
    participant Shell as Command Executor
    participant Nproc as nproc Utility
    participant Clang as Clang-Tidy

    GH->>LintJob: Trigger linting workflow
    LintJob->>Shell: Execute "task lint:check -C $(nproc)"
    Shell->>Nproc: Request number of CPU cores
    Nproc-->>Shell: Return core count
    Shell->>LintJob: Run lint operations concurrently based on core count
    LintJob->>Clang: Invoke :utils:cpp-lint:clang-tidy-find with updated parameters
    Clang-->>LintJob: Return lint results
    LintJob-->>GH: Report lint outcomes
Loading

Possibly related PRs


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@sitaowang1998
sitaowang1998 requested a review from davidlion April 5, 2025 00:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
lint-tasks.yaml (1)

82-96: Consolidated Clang-Tidy Task Configuration

The updated cpp-static-check task now consolidates multiple clang-tidy runs into a single unified task (:utils:cpp-lint:clang-tidy-find). Using the shared anchor *cpp_source_files for both the sources and ROOT_PATHS fields improves consistency and maintainability. Additionally, breaking out the clang-tidy flags into a list (for example, "--config-file '{{.ROOT_DIR}}/.clang-tidy'" and "-p '{{.G_SPIDER_COMPILE_COMMANDS_DB}}'") clarifies the configuration.

As a minor point, please double-check the nested quoting in the FLAGS entries to ensure the intended parameters are correctly interpreted by clang-tidy in the execution environment.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a763de and f6d0b6b.

📒 Files selected for processing (2)
  • .github/workflows/code-linting-checks.yaml (1 hunks)
  • lint-tasks.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: lint
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
🔇 Additional comments (1)
.github/workflows/code-linting-checks.yaml (1)

52-52: Efficient Parallelisation for Clang-Tidy Linting

The change on line 52 to invoke task lint:check -C $(nproc) effectively leverages all available CPU cores, which should significantly reduce the overall linting time. This modification aligns directly with the PR objective of enhancing CI efficiency.

@davidlion davidlion changed the title ci: Use parallelized clang-tidy task from yscope-dev-utils ci: Use parallelized clang-tidy task from yscope-dev-utils. Apr 5, 2025
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