Skip to content

ci(pre-commit): add pre-commit checks to CI pipeline - #563

Merged
slin1237 merged 1 commit into
mainfrom
chang/ci
Feb 27, 2026
Merged

slin1237 merged 1 commit into
mainfrom
chang/ci

Conversation

@CatherineSue

@CatherineSue CatherineSue commented Feb 27, 2026 •

Copy link
Copy Markdown
Member

Description

Problem

Most pre-commit hooks (trailing-whitespace, end-of-file-fixer, check-yaml, check-toml, codespell, etc.) are only enforced locally. If a contributor skips or doesn't have pre-commit installed, these checks are bypassed — CI only runs ruff, rustfmt, and clippy.

Solution

Add a pre-commit job to the PR CI workflow that runs pre-commit run --all-files. Hooks already covered by dedicated CI jobs (rustfmt, clippy) and commit/push-time hooks (no-commit-to-branch, branch-name-check, dco-check) are skipped via the SKIP env var.

Changes

  • Added pre-commit job to .github/workflows/pr-test-rust.yml
  • Added pre-commit to the finish gate job (needs + failure check)
  • Fixed missing trailing newlines in grpc_client/proto/trtllm_service.proto and grpc_client/proto/vllm_engine.proto

Test Plan

  • The new pre-commit job will run on this PR itself, validating the setup.
Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated

Summary by CodeRabbit

  • Chores
    • Enhanced continuous integration pipeline with additional quality assurance checks to maintain code consistency and standards.
    • Applied code formatting improvements across the codebase.

Run pre-commit hooks (trailing-whitespace, end-of-file-fixer,
check-yaml, codespell, etc.) in CI to enforce checks even when
contributors skip local pre-commit. Skips rustfmt, clippy, and
commit/push-time hooks that are already covered or not applicable.

Signed-off-by: Chang Su <chang.s.su@oracle.com>
@github-actions github-actions Bot added ci CI/CD configuration changes grpc gRPC client and router changes labels Feb 27, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's continuous integration pipeline by introducing a dedicated job to run pre-commit checks. This change ensures that formatting, linting, and other pre-commit hooks, which were previously only enforced locally, are now validated in CI. This prevents common issues from being merged and improves overall code quality and consistency. Additionally, it includes minor formatting fixes for two Protobuf definition files.

Highlights

  • CI Pipeline Enhancement: A new pre-commit job has been added to the PR CI workflow (.github/workflows/pr-test-rust.yml) to enforce local pre-commit checks at the CI level.
  • CI Workflow Integration: The pre-commit job has been integrated into the finish gate job, ensuring its successful completion is a prerequisite for the overall CI status.
  • Code Formatting Fixes: Missing trailing newlines were added to grpc_client/proto/trtllm_service.proto and grpc_client/proto/vllm_engine.proto to comply with formatting standards.
Changelog
  • grpc_client/proto/trtllm_service.proto
    • Added a trailing newline to the end of the file.
  • grpc_client/proto/vllm_engine.proto
    • Added a trailing newline to the end of the file.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/pr-test-rust.yml
Activity
  • The new pre-commit CI job is expected to run on this pull request itself, serving as its own validation test.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Feb 27, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Introduces a new pre-commit validation job in the CI workflow that runs Python checks before the existing lint suite, updates the finish job to depend on the new pre-commit job, and expands result gating to account for pre-commit and additional job failures. Minor formatting changes to proto files.

Changes

Cohort / File(s) Summary
CI Workflow Pre-commit Integration
.github/workflows/pr-test-rust.yml
Adds a new pre-commit job that sets up Python 3.13, installs and runs pre-commit checks with specific hooks skipped via SKIP variable. Updates finish job dependencies to require pre-commit and expands result gating logic to check pre-commit status alongside existing checks (unit-tests, gateway-e2e, go-unit-tests, go-bindings-e2e).
Proto File Formatting
grpc_client/proto/trtllm_service.proto, grpc_client/proto/vllm_engine.proto
Adds trailing newline to end-of-file closing braces in proto definitions. No semantic or structural changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

ci

Suggested reviewers

  • key4ng
  • slin1237
  • XinyueZhang369

Poem

🐰 A pre-commit job hops into the CI,
Checking protos with a careful eye,
Dependencies aligned, results all tight,
The workflow dances—oh what a sight!
Formatting finished with a newline's care,
The pipeline's ready beyond compare! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci(pre-commit): add pre-commit checks to CI pipeline' directly and clearly summarizes the main change: adding pre-commit checks to the CI pipeline.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chang/ci

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a pre-commit job to the CI pipeline to enforce code style and formatting checks automatically. The changes also include fixes for missing newlines at the end of two protobuf files (trtllm_service.proto and vllm_engine.proto), which were likely identified by the new pre-commit hooks. The changes are correct and improve code consistency. I have no specific comments as the changes are minor stylistic fixes and there are no issues of medium or higher severity.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/pr-test-rust.yml (1)

576-584: 🧹 Nitpick | 🔵 Trivial

LGTM!

The failure check correctly includes pre-commit.result alongside all other jobs from the needs array.

💡 Optional: Consider handling `cancelled` job state

The current logic only checks for "failure" but jobs can also be "cancelled" (e.g., due to timeouts or workflow cancellation). If you want stricter gating:

-          if [[ "${{ needs.pre-commit.result }}" == "failure" || \
+          if [[ "${{ needs.pre-commit.result }}" != "success" && "${{ needs.pre-commit.result }}" != "skipped" ]] || \
+             [[ "${{ needs.python-lint.result }}" != "success" && "${{ needs.python-lint.result }}" != "skipped" ]] || \

This is pre-existing behavior, so addressing it is out of scope for this PR.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-test-rust.yml around lines 576 - 584, The current
GitHub Actions conditional in the if [[ ... ]] block only treats job results
equal to "failure"; to also gate on cancelled jobs, update the condition that
checks each needs.*.result (e.g., needs.pre-commit.result,
needs.python-lint.result, needs.grpc-proto-build-check.result, etc.) to test for
either "failure" OR "cancelled" (for example by combining checks like "${{
needs.X.result }}" == "failure" || "${{ needs.X.result }}" == "cancelled") so
the overall if condition triggers when any dependent job is either failed or
cancelled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/pr-test-rust.yml:
- Around line 576-584: The current GitHub Actions conditional in the if [[ ...
]] block only treats job results equal to "failure"; to also gate on cancelled
jobs, update the condition that checks each needs.*.result (e.g.,
needs.pre-commit.result, needs.python-lint.result,
needs.grpc-proto-build-check.result, etc.) to test for either "failure" OR
"cancelled" (for example by combining checks like "${{ needs.X.result }}" ==
"failure" || "${{ needs.X.result }}" == "cancelled") so the overall if condition
triggers when any dependent job is either failed or cancelled.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0b6051 and 2641830.

📒 Files selected for processing (3)
  • .github/workflows/pr-test-rust.yml
  • grpc_client/proto/trtllm_service.proto
  • grpc_client/proto/vllm_engine.proto

@slin1237
slin1237 merged commit 8552f74 into main Feb 27, 2026
22 of 24 checks passed
@slin1237
slin1237 deleted the chang/ci branch February 27, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD configuration changes grpc gRPC client and router changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants