| # |
| # 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: Style |
| |
| on: |
| pull_request: |
| branches: |
| - master |
| - branch-* |
| |
| concurrency: |
| group: linter-${{ github.head_ref || github.run_id }} |
| cancel-in-progress: true |
| |
| jobs: |
| linter: |
| name: Style check |
| runs-on: ubuntu-24.04 |
| strategy: |
| matrix: |
| profiles: |
| - '-Pflink-provided,hive-provided,spark-provided,spark-3.5,spark-3.4,spark-3.3,tpcds,kubernetes-it' |
| |
| steps: |
| - uses: actions/checkout@v4 |
| with: |
| fetch-depth: 0 |
| - name: Setup JDK 17 |
| uses: actions/setup-java@v4 |
| with: |
| distribution: temurin |
| java-version: 17 |
| cache: 'maven' |
| - name: Setup Maven |
| uses: ./.github/actions/setup-maven |
| - name: Setup Python 3 |
| uses: actions/setup-python@v5 |
| with: |
| python-version: '3.9' |
| cache: 'pip' |
| - name: Check kyuubi modules avaliable |
| id: modules-check |
| run: build/mvn dependency:resolve -DincludeGroupIds="org.apache.kyuubi" -DincludeScope="compile" -DexcludeTransitive=true ${{ matrix.profiles }} |
| continue-on-error: true |
| |
| - name: Install |
| # When a continue-on-error step fails, the outcome is failure, but the final conclusion is success. |
| # for more details, please visit: https://github.com/actions/toolkit/issues/399#issuecomment-666147717 |
| if: steps.modules-check.conclusion == 'success' && steps.modules-check.outcome == 'failure' |
| run: | |
| export MAVEN_ARGS="-DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=warn -Drat.skip=true -Dmaven.scalastyle.skip=true -Dspotless.check.skip=true -Pflink-provided,hive-provided,spark-provided" |
| build/mvn clean install -Ptpcds |
| build/mvn clean install -pl extensions/spark/kyuubi-extension-spark-3-3 -am -Pspark-3.3 |
| build/mvn clean install -pl extensions/spark/kyuubi-extension-spark-3-4 -am -Pspark-3.4 |
| build/mvn clean install -pl extensions/spark/kyuubi-extension-spark-3-5,extensions/spark/kyuubi-spark-connector-hive -am -Pspark-3.5 |
| build/mvn clean install -pl extensions/spark/kyuubi-extension-spark-4-0 -am -Pspark-4.0 -Pscala-2.13 |
| build/mvn clean install -pl extensions/spark/kyuubi-extension-spark-4-1 -am -Pspark-4.1 -Pscala-2.13 |
| |
| - name: Scalastyle with maven |
| id: scalastyle-check |
| run: | |
| build/mvn scalastyle:check ${{ matrix.profiles }} |
| - name: Print scalastyle error report |
| if: failure() && steps.scalastyle-check.outcome != 'success' |
| run: >- |
| for log in `find * -name "scalastyle-output.xml"`; |
| do |
| if grep -q "error" $log; then |
| cat $log; |
| fi |
| done |
| - name: Spotless style check |
| run: | |
| SPOTLESS_BLACK_VERSION=$(build/mvn help:evaluate -Dexpression=spotless.python.black.version -q -DforceStdout) |
| pip install black==$SPOTLESS_BLACK_VERSION |
| build/mvn spotless:check ${{ matrix.profiles }} -Pspotless-python |
| - name: Get NodeJS and PNPM version |
| run: | |
| NODEJS_VERSION=$(build/mvn help:evaluate -Dexpression=node.version -q -DforceStdout) |
| PNPM_VERSION=$(build/mvn help:evaluate -Dexpression=pnpm.version -q -DforceStdout) |
| echo "NODEJS_VERSION=${NODEJS_VERSION}" >> "$GITHUB_ENV" |
| echo "PNPM_VERSION=${PNPM_VERSION}" >> "$GITHUB_ENV" |
| - name: setup npm |
| uses: actions/setup-node@v4 |
| with: |
| node-version: ${{env.NODEJS_VERSION}} |
| - name: Web UI Style with node |
| run: | |
| cd ./kyuubi-server/web-ui |
| npm install pnpm@${PNPM_VERSION} -g |
| pnpm install --frozen-lockfile |
| pnpm run lint |
| echo "---------------------------------------Notice------------------------------------" |
| echo "If this style check fail, you should follow these commands for a tentative fix" |
| echo "* cd ./kyuubi-server/web-ui" |
| echo "* npm run lint-fix" |
| echo "Following the above steps can solve many style problems. " |
| echo "If there is a problem that cannot be fixed by the command, " |
| echo "you need to manually fix it by following the information told by the command above" |
| echo "---------------------------------------------------------------------------------" |
| |
| - name: Super Linter Checks |
| uses: github/super-linter/slim@v7 |
| env: |
| CREATE_LOG_FILE: true |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| IGNORE_GENERATED_FILES: true |
| IGNORE_GITIGNORED_FILES: true |
| LINTER_RULES_PATH: / |
| LOG_LEVEL: NOTICE |
| SUPPRESS_POSSUM: true |
| VALIDATE_BASH_EXEC: true |
| VALIDATE_JSONC: true |
| VALIDATE_POWERSHELL: true |
| VALIDATE_XML: true |
| - name: Upload Super Linter logs |
| if: failure() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: super-linter-log |
| path: super-linter.log |