This is an automated email from the ASF dual-hosted git repository.
hello-stephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 56e4660f30e [chore](ci) Introduce one path-aware Code Style gate on
master (#71294)
56e4660f30e is described below
commit 56e4660f30eb8810070d8d3483863ad10a796064
Author: shuke <[email protected]>
AuthorDate: Wed Dec 2 18:48:29 2026 +0800
[chore](ci) Introduce one path-aware Code Style gate on master (#71294)
### Background
Doris starts separate Java and C++ style jobs for each pull request
update. In a December 2 sample of 103 paired PR updates, 60 needed only
one of the two checks. Both jobs requested a runner and checked out the
source before selecting paths when the PR head was current.
### What problem does this PR solve?
Issue Number: None
Related PR: #67119 (stale PR checks), #71282 (Ubuntu runner selection)
PR Type: Build/CI/Chore
Problem Summary: Have one required Code Style job select Java and C++
checks before checking out the source. The existing master rules require
the two previous check names to merge this PR. Both workflows stay
active during the transition. A separate cleanup will remove them after
the hosted Code Style check passes and the new ruleset takes effect.
### Details
- **Affected:** The master ruleset and a new pull request workflow.
- **Behavior change:** Compare the immutable PR commits, including
previous filenames. Check both languages when the comparison cannot
establish a complete file list or the workflow changes.
- **Developer and release impact:** Master requires Code Style.
Validation uses the PR merge checkout, the existing Java and Clang
commands, and read-only permissions. C++ failures still allow the Java
check to run.
- **License and third-party:** The Clang action stays at its existing
pinned commit.
- **Rollback:** Restore the old required contexts while their workflows
are present.
### Testing
Actionlint, 22 selection cases including four historical PR snapshots,
stale-head and step-failure checks, and a structural comparison of
branch rules passed. JDK 17 Maven CheckStyle passed all 93 reactor
modules. The pinned Clang script with clang-format 16.0.6 checked 5,244
source files and rejected a malformed fixture locally.
### Release note
None.
### Check List (For Author)
- Behavior changed: Yes (see Details).
- Does this need documentation: No.
- Pre-submission status: Partially verified. GitHub-hosted execution and
the live ASF ruleset transition require publication.
### AI Disclosure
- Tool: OpenAI Codex.
- Generated: Implementation, local verification and description.
- Human review: Pending.
---
.asf.yaml | 3 +-
.github/workflows/code-style.yml | 114 +++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+), 2 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index e814a51ff39..efbb5d15abb 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -68,8 +68,7 @@ github:
required_status_checks:
- context: License Check
- context: Check for secrets
- - context: Clang Formatter
- - context: CheckStyle
+ - context: Code Style
- context: TeamCity/p0
- context: TeamCity/nonconcurrent
- context: TeamCity/external
diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml
new file mode 100644
index 00000000000..f1d282589f1
--- /dev/null
+++ b/.github/workflows/code-style.yml
@@ -0,0 +1,114 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+name: Code Style
+
+on:
+ pull_request:
+ branches: [master]
+
+permissions:
+ contents: read
+ pull-requests: read
+
+jobs:
+ style:
+ name: Code Style
+ runs-on: ubuntu-24.04
+ concurrency:
+ group: code-style-${{ github.event.pull_request.number }}-${{ github.sha
}}
+ cancel-in-progress: true
+ steps:
+ - name: Verify current PR head
+ env:
+ GH_TOKEN: ${{ github.token }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ current_head=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER"
--jq '.head.sha')
+ if [[ "$current_head" != "$HEAD_SHA" ]]; then
+ echo "::error::PR #$PR_NUMBER moved from $HEAD_SHA to
$current_head; refusing stale validation"
+ exit 1
+ fi
+
+ - name: Select checks for the PR snapshot
+ id: paths
+ env:
+ GH_TOKEN: ${{ github.token }}
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ shell: bash
+ run: |
+ # The first compare page lists at most 300 files. At the limit, run
both checks.
+ if ! selection=$(gh api
"repos/$GITHUB_REPOSITORY/compare/$BASE_SHA...$HEAD_SHA?per_page=1" |
+ jq -er '
+ .files | select(type == "array" and length < 300)
+ | [.[] | .filename, (.previous_filename // empty)]
+ | any(.[]; . == ".github/workflows/code-style.yml") as $workflow
+ | ($workflow or any(.[]; test("^(fe/|gensrc/(proto|thrift)/)")))
as $java
+ | ($workflow or any(.[]; test("^(be|cloud)/(src|test)/"))) as
$cpp
+ | "java=\($java)\ncpp=\($cpp)"'); then
+ echo "::warning::Changed paths unavailable or incomplete; running
both style checks"
+ selection=$'java=true\ncpp=true'
+ fi
+ printf '%s\n' "$selection" >> "$GITHUB_OUTPUT"
+
+ - name: Checkout source
+ id: source
+ if: steps.paths.outputs.java == 'true' || steps.paths.outputs.cpp ==
'true'
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Checkout clang-format action
+ if: steps.paths.outputs.cpp == 'true'
+ uses: actions/checkout@v7
+ with:
+ repository: DoozyX/clang-format-lint-action
+ ref: c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2
+ path: .github/actions/clang-format-lint-action
+ persist-credentials: false
+
+ - name: Set up Python for clang-format
+ if: steps.paths.outputs.cpp == 'true'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.10'
+
+ - name: Run Clang Formatter
+ if: steps.paths.outputs.cpp == 'true'
+ uses: ./.github/actions/clang-format-lint-action
+ with:
+ source: 'be/src be/test cloud/src cloud/test'
+ clangFormatVersion: 16
+ inplace: false
+
+ - name: Set up JDK with Maven
+ id: jdk
+ # Report Java violations even if the C++ check failed on the same PR.
+ if: "!cancelled() && steps.source.outcome == 'success' &&
steps.paths.outputs.java == 'true'"
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: maven
+
+ - name: Run Java CheckStyle
+ if: "!cancelled() && steps.jdk.outcome == 'success'"
+ working-directory: fe
+ run: mvn clean checkstyle:check
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]