Skip to content

[AIROCMLIR-197] Move C++ format/tidy checks to GitHub Actions#2356

Open
bogdan-petkovic wants to merge 25 commits into
ROCm:developfrom
bogdan-petkovic:bogdan-petkovic/move-lint-to-gh-actions
Open

[AIROCMLIR-197] Move C++ format/tidy checks to GitHub Actions#2356
bogdan-petkovic wants to merge 25 commits into
ROCm:developfrom
bogdan-petkovic:bogdan-petkovic/move-lint-to-gh-actions

Conversation

@bogdan-petkovic
Copy link
Copy Markdown
Contributor

@bogdan-petkovic bogdan-petkovic commented Apr 22, 2026

Motivation

Move C/C++ formatting and diff-based clang-tidy checks out of Jenkins so GPU CI isn't blocked by style issues, and enforce these checks earlier/cheaper in GitHub Actions.

Technical Details

  • Add a new GitHub Actions job (cpp-static-checks) that runs the existing Jenkins premerge script mlir/utils/jenkins/static-checks/premerge-checks.py inside the rocm/mlir:rocm7.2-latest container, reusing the same tooling and --ignore-external flag as Jenkins.
  • Generate build/compile_commands.json via CMake configure (-DCMAKE_EXPORT_COMPILE_COMMANDS=ON, -DMLIR_ENABLE_ROCM_RUNNER=1) and symlink compile_commands.json as expected by the script.
  • Add caching for the build/ directory to reduce repeated configure cost on PR updates.
  • Job runs only on pull_request events to avoid no-op diffs on direct pushes to develop.
  • No changes to Jenkinsfile — Jenkins preMergeCheck continues to run in parallel during the validation period.
  • Simplify local git hooks: consolidate all C/C++ formatting into .githooks/pre-commit

Test Plan

  • Validate the GitHub Actions workflow runs premerge-checks.py (clang-format diff + clang-tidy-diff) against the PR base ref.
  • Confirm Jenkins continues to execute preMergeCheck() on the GPU PR lane unchanged.
  • Confirm .githooks/pre-commit catches C/C++ formatting issues on staged files.

Test Result

Not run locally; relies on GitHub Actions and Jenkins pipeline execution after submission.

Submission Checklist

@bogdan-petkovic bogdan-petkovic force-pushed the bogdan-petkovic/move-lint-to-gh-actions branch from fcb2e9d to ff2cfcf Compare April 22, 2026 09:46
Comment thread .githooks/pre-push Outdated
Comment thread mlir/utils/jenkins/Jenkinsfile
@bogdan-petkovic bogdan-petkovic force-pushed the bogdan-petkovic/move-lint-to-gh-actions branch from 73aed8e to cb4015c Compare April 23, 2026 14:06
@bogdan-petkovic bogdan-petkovic marked this pull request as ready for review April 24, 2026 11:59
…ng on formatting

Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
@bogdan-petkovic bogdan-petkovic force-pushed the bogdan-petkovic/move-lint-to-gh-actions branch from cb4015c to d953156 Compare April 24, 2026 13:30
@umangyadav
Copy link
Copy Markdown
Member

@bogdan-petkovic can you review using AI agents first ? it is reporting some major problems

@dorde-antic dorde-antic requested a review from Copilot April 24, 2026 13:43
@dorde-antic
Copy link
Copy Markdown
Contributor

@bogdan-petkovic can you review using AI agents first ? it is reporting some major problems

@umangyadav I've assigned copilot for that

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR moves C/C++ diff-based clang-format and clang-tidy checks out of Jenkins and into GitHub Actions by introducing a dedicated cpp-static-checks job that runs the existing mlir/utils/jenkins/static-checks/premerge-checks.py inside the rocm/mlir:rocm7.2-latest container.

Changes:

  • Add a new cpp-static-checks GitHub Actions job to run diff-based clang-format and clang-tidy checks.
  • Generate and expose compile_commands.json via CMake configure (-DCMAKE_EXPORT_COMPILE_COMMANDS=ON) for the tidy-diff step.
  • Add caching for the build/ directory to reduce repeated CMake configure cost.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
bogdan-petkovic and others added 8 commits April 27, 2026 09:37
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
…NER=1

Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
…time

Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
@bogdan-petkovic bogdan-petkovic force-pushed the bogdan-petkovic/move-lint-to-gh-actions branch from 5053f03 to 6b9162c Compare May 26, 2026 08:57
@rocmlir-pr-reviewer rocmlir-pr-reviewer Bot added the modifies-ci-paths PR modifies the Claude review CI security perimeter; audit before applying claude-review label May 28, 2026
@rocmlir-pr-reviewer
Copy link
Copy Markdown

⚠️ This PR modifies the Claude-review CI security perimeter

The following files in this PR control whether and how the
claude-review workflow protects its LLM Gateway secrets at
runtime (see the SECURITY MODEL section in
.github/workflows/claude_auto_review.yml):

  • .github/workflows/ci.yml

Before applying the claude-review label on this PR, please:

  1. Audit the diff in these paths line-by-line. A malicious or
    accidental change could disable the --allowedTools
    restriction, the overlay step, the sanitizer, or the
    review/post job split -- any of which would expose the
    secrets in env to the PR-modified workflow.
  2. If the changes are legitimate and you want a Claude review,
    do NOT apply the claude-review label. Instead, run via
    Actions → Claude Auto Review → Run workflow and enter
    this PR's number. The dispatch path runs from the trusted,
    code-owner-approved version of the workflow on
    develop, so a malicious PR-side
    modification cannot affect the run.

(This banner is automated. The modifies-ci-paths label
will be removed automatically if a future push removes the
perimeter modifications. The Layer-3 in-workflow guard will
additionally fail the claude-review label-triggered run
on this PR if the label is applied while perimeter changes
are present.)

check_cxx_compiler_flag(-Wno-c++98-compat-extra-semi
CXX_SUPPORTS_NO_CXX98_COMPAT_EXTRA_SEMI_FLAG)
if (CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG)
if(CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG AND TARGET mlir_rocm_runtime)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable name mismatch: check_cxx_compiler_flag on line 47 stores its result in CXX_SUPPORTS_NO_CXX98_COMPAT_EXTRA_SEMI_FLAG (with _NO_), but this if checks CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG (without _NO_). The condition is therefore always false and -Wno-c++98-compat-extra-semi is never actually applied to mlir_rocm_runtime. The three sibling blocks below all use matching names, so this one stands out. Since this PR is already modifying this exact line to add the AND TARGET ... guard, please fix the typo here as well.

Suggested change
if(CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG AND TARGET mlir_rocm_runtime)
if(CXX_SUPPORTS_NO_CXX98_COMPAT_EXTRA_SEMI_FLAG AND TARGET mlir_rocm_runtime)

@rocmlir-pr-reviewer
Copy link
Copy Markdown

Reviewed 2 files (.github/workflows/ci.yml; mlir/tools/rocmlir-tuning-driver/CMakeLists.txt). The new cpp-static-checks job correctly limits itself to pull_request events, uses a slash-free per-PR cache key, and validates git-clang-format presence before invoking premerge-checks.py — addressing the earlier reviewer concerns. Found 1 Major issue: a pre-existing variable-name typo on a line this PR is modifying makes one of the warning suppressions dead code. CI is green (C/C++ premerge checks passing). Verdict: COMMENT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifies-ci-paths PR modifies the Claude review CI security perimeter; audit before applying claude-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants