-
Notifications
You must be signed in to change notification settings - Fork 595
[VL][CI] Add a format checker for scala code to enable early failure reporting #10747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # 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 Format Check | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/scala_code_format.yml' | ||
| - 'backends-velox/**' | ||
| - 'gluten-uniffle/**' | ||
| - 'gluten-celeborn/**' | ||
| - 'gluten-ras/**' | ||
| - 'gluten-core/**' | ||
| - 'gluten-substrait/**' | ||
| - 'gluten-arrow/**' | ||
| - 'gluten-delta/**' | ||
| - 'gluten-iceberg/**' | ||
| - 'gluten-hudi/**' | ||
| - 'gluten-paimon/**' | ||
| - 'gluten-ut/**' | ||
| - 'shims/**' | ||
| - 'tools/gluten-it/**' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| SETUP: 'bash .github/workflows/util/setup_helper.sh' | ||
|
|
||
| jobs: | ||
|
|
||
| scala-format-check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Check | ||
| run: | | ||
| ./dev/format-scala-code.sh check | ||
| - name: Fix | ||
| if: failure() | ||
| run: | | ||
| ./dev/format-scala-code.sh | ||
| git show |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| # 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. | ||
|
|
||
| # If a new profile is introduced for new modules, please add it here to ensure | ||
| # the new modules are covered. | ||
| PROFILES="-Pbackends-velox -Pceleborn,uniffle -Piceberg,delta,hudi,paimon \ | ||
| -Pspark-3.2,spark-3.3,spark-3.4,spark-3.5,spark-4.0 -Pspark-ut" | ||
|
Comment on lines
+20
to
+21
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is not for a CI task that is only for VL backend, let's add CH's code as well.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comment. I note all scripts under dev/ are related to velox backend. Perhaps it’s better to continue excluding the CH backend in this script. |
||
|
|
||
| COMMAND=$1 | ||
|
|
||
| if [[ "$COMMAND" == "check" ]]; then | ||
| echo "Checking Scala code style.." | ||
| mvn -q spotless:check $PROFILES | ||
| elif [[ "$COMMAND" == "apply" ]] || [[ "$COMMAND" == "" ]]; then | ||
| echo "Fixing Scala code style.." | ||
| mvn -q spotless:apply $PROFILES | ||
| else | ||
| echo "Unrecognized option." | ||
| exit 1 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, once may not figure out the meaning of
Enhancedat first glance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhztheplayer, thanks for the comment. I feel this simple name is descriptive enough, especially since it's intended for developers only. Not a strong preference. I can revert to the full name if you think it's more appropriate. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just keep it if you have strong reason. Never tended to be nitpicking :)