Skip to content

Conversation

shenxianpeng
Copy link
Collaborator

@shenxianpeng shenxianpeng commented Jul 4, 2025

closes #82

Summary by CodeRabbit

  • Chores
    • Added a new GitHub Actions workflow for end-to-end testing, allowing tests to be triggered on main branch updates, pull requests, or manually with configurable options.

@shenxianpeng shenxianpeng added the enhancement New feature or request label Jul 4, 2025
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.48%. Comparing base (d3169df) to head (36d3400).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #83   +/-   ##
=======================================
  Coverage   94.48%   94.48%           
=======================================
  Files           3        3           
  Lines         145      145           
=======================================
  Hits          137      137           
  Misses          8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

coderabbitai bot commented Jul 4, 2025

"""

Walkthrough

A new GitHub Actions workflow named "E2E Test" has been introduced. This workflow automates cloning a target repository, replacing its pre-commit configuration with a minimal clang-format hook config, installing pre-commit, and running all pre-commit hooks on the repository files, supporting both default and user-supplied options.

Changes

File(s) Change Summary
.github/workflows/e2e.yml Added a new GitHub Actions workflow for end-to-end testing with configurable inputs and steps.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant Target Repo
    participant cpp-linter-hooks

    User->>GitHub Actions: Push/PR to main or manual dispatch
    GitHub Actions->>GitHub Actions: Checkout current repo
    GitHub Actions->>GitHub Actions: Setup Python 3.13 and pip
    GitHub Actions->>GitHub Actions: Install pre-commit
    GitHub Actions->>Target Repo: Clone (default: llvm/llvm-project)
    GitHub Actions->>Target Repo: Replace .pre-commit-config.yaml with clang-format hook config
    GitHub Actions->>Target Repo: Install pre-commit hooks
    GitHub Actions->>Target Repo: Run pre-commit on all files
    Target Repo->>cpp-linter-hooks: Use clang-format hook (v20.1.7)
Loading

Assessment against linked issues

Objective Addressed Explanation
Add real case tests workflow that clones a target repo, replaces pre-commit config, installs hooks, and runs pre-commit on all files (#82)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.
"""


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 114e7d9 and 36d3400.

📒 Files selected for processing (1)
  • .github/workflows/e2e.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/e2e.yml

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

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

🧹 Nitpick comments (1)
.github/workflows/e2e.yml (1)

37-45: Ensure requested Clang binary is actually available

The runner doesn’t ship with clang-format-20.
Without installing the matching tool, the hook will fail (or default to an older clang). Add an explicit install step before running pre-commit:

       - name: Install dependencies
         run: |
           python -m pip install --upgrade pip
           python -m pip install pre-commit
+
+      - name: Install clang-format
+        run: |
+          sudo apt-get update -qq
+          sudo apt-get install -y clang-format-${{ github.event.inputs.clang_version || '20' }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4c09c13 and 70a5959.

📒 Files selected for processing (1)
  • .github/workflows/e2e.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/e2e.yml

33-33: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Run benchmarks
  • GitHub Check: Test cpp-linter-hooks
🔇 Additional comments (1)
.github/workflows/e2e.yml (1)

32-35: Update to the current major of setup-python

actions/setup-python@v4 is already flagged by actionlint as too old.
GitHub released v5 with improved caching and deprecation notices – migrating is trivial and future-proofs the workflow.

-      - name: Set up Python 3.11
-        uses: actions/setup-python@v4
+      - name: Set up Python 3.11
+        uses: actions/setup-python@v5

Copy link

codspeed-hq bot commented Jul 4, 2025

CodSpeed Performance Report

Merging #83 will not alter performance

Comparing add-workflow-to-test-cpython (70a5959) with main (4c09c13)

Summary

✅ 31 untouched benchmarks

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 4, 2025
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

♻️ Duplicate comments (1)
.github/workflows/e2e.yml (1)

53-55: --version still turns clang-format into a no-op
Passing --version prints the version and exits, so the hook never formats any files and the test becomes meaningless. This was flagged previously and is still present.

-                - id: clang-format
-                  args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}]
+                - id: clang-format
+                  args: [--style=${{ github.event.inputs.style || 'Google' }}]
🧹 Nitpick comments (1)
.github/workflows/e2e.yml (1)

60-63: pre-commit install is unnecessary in CI
pre-commit run --all-files does not require the git hook to be installed. Dropping the install call shaves ~2 s and avoids side effects.

-          pre-commit install
           pre-commit run --all-files
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a855e93 and adcb858.

📒 Files selected for processing (1)
  • .github/workflows/e2e.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/e2e.yml

31-31: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e-test

Comment on lines 35 to 39
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Install the required clang-format binary
The workflow relies on clang-format (potentially version 20) being present on the runner, but nothing installs it. Without the binary every run will fail. Add an explicit install step before running pre-commit.

       - name: Install dependencies
         run: |
+          sudo apt-get update
+          sudo apt-get install -y clang-format-${{ github.event.inputs.clang_version || '20' }}
           python -m pip install --upgrade pip
           python -m pip install pre-commit
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format-${{ github.event.inputs.clang_version || '20' }}
python -m pip install --upgrade pip
python -m pip install pre-commit
🤖 Prompt for AI Agents
In .github/workflows/e2e.yml around lines 35 to 39, the workflow installs pip
and pre-commit but does not install the required clang-format binary, causing
runs to fail. Add a step before installing pre-commit to explicitly install
clang-format on the runner, ensuring the correct version is available for
pre-commit hooks.

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

♻️ Duplicate comments (2)
.github/workflows/e2e.yml (2)

55-59: clang-format never runs with --version – remove the flag again
We previously discussed that passing --version causes clang-format to exit immediately, so the hook reports success without touching any files. The flag has resurfaced here and will break every test run.

-                - id: clang-format
-                  args: [
-                    --style=${{ github.event.inputs.style || 'file' }},
-                    --version=${{ matrix.clang_version }}
-                  ]
+                - id: clang-format
+                  args: [
+                    --style=${{ github.event.inputs.style || 'file' }}
+                  ]

37-41: clang-format binary is missing – workflow will error out
The job installs pre-commit but never installs the specific clang-format-<version> binaries required by the hook. All eight matrix legs will fail with “clang-format: command not found”.

Add an explicit install step before running the hooks:

       - name: Install Python dependencies
         run: |
           python -m pip install --upgrade pip
           python -m pip install pre-commit
+
+      - name: Install clang-format ${{ matrix.clang_version }}
+        run: |
+          sudo apt-get update -y
+          sudo apt-get install -y clang-format-${{ matrix.clang_version }} || sudo apt-get install -y clang-format
🧹 Nitpick comments (1)
.github/workflows/e2e.yml (1)

44-45: Use the already-defined default instead of the || fallback
workflow_dispatch inputs already supply a default value. The extra || 'llvm/llvm-project' makes the expression harder to read and, on push/pull_request events where github.event.inputs is undefined, resolves to null, producing a URL ending in .git. Prefer the shorter and always-defined form:

-          git clone --depth=1 https://github.com/${{ github.event.inputs.target_repo || 'llvm/llvm-project' }}.git test-repo
+          git clone --depth=1 https://github.com/${{ inputs.target_repo }}.git test-repo
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a599c9f and edcb8ff.

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

Copy link

@shenxianpeng shenxianpeng added tests This PR adds/removes/updates test cases and removed documentation Improvements or additions to documentation enhancement New feature or request labels Sep 2, 2025
@shenxianpeng shenxianpeng force-pushed the main branch 2 times, most recently from 2bdffbb to a076581 Compare September 19, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests This PR adds/removes/updates test cases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add real case tests workflow
1 participant