From dbe8999eed25f68fe4bb2621627036c9e4eaa90e Mon Sep 17 00:00:00 2001 From: Kent Yao Date: Sat, 19 Mar 2022 02:56:50 +0800 Subject: [PATCH] Improve CI with cancel & concurrency --- .github/workflows/dep.yml | 56 +++++++++++++++++++++++++++++++++++++ .github/workflows/style.yml | 19 ++++--------- 2 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/dep.yml diff --git a/.github/workflows/dep.yml b/.github/workflows/dep.yml new file mode 100644 index 00000000000..e9c15e9362d --- /dev/null +++ b/.github/workflows/dep.yml @@ -0,0 +1,56 @@ +# +# 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 check + +# This GitHub workflow checks style & dependency issues. + +on: + pull_request: + branches: + - master + - branch-* + paths: + - '**pom.xml' + +concurrency: + group: linter-${{ github.ref }} + cancel-in-progress: true + +env: + MAVEN_OPTS: -Dorg.slf4j.simpleLogger.defaultLogLevel=error + +jobs: + linter: + name: Style and Dependency check + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Setup JDK 8 + uses: actions/setup-java@v2 + with: + distribution: zulu + java-version: 8 + cache: 'maven' + check-latest: false + - name: Maven install + run: >- + build/mvn -T 4 clean install -Pflink-provided,spark-provided + -Dmaven.javadoc.skip=true -Drat.skip=true -Dscalastyle.skip=true -Dspotless.check.skip -DskipTests + -pl kyuubi-ctl,kyuubi-server,kyuubi-assembly -am + - name: Check dependency list + run: build/dependency.sh diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index a7cc27a7812..da42601ebda 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -32,9 +32,14 @@ concurrency: env: MAVEN_OPTS: -Dorg.slf4j.simpleLogger.defaultLogLevel=error +# no install runs before style check because it is expensive, we can skip build if style fails +# Well, sometimes when we introduce a new module, it may 'fail' the style check for missing +# dependency we just create for other module to inherit. +# We can ignore this failure and merge the PR, if we see the style check pass on the new module + # or via a local quick verification. jobs: linter: - name: Style and Dependency check + name: Style check runs-on: ubuntu-20.04 strategy: matrix: @@ -56,15 +61,3 @@ jobs: run: for log in `find * -name "scalastyle-output.xml"`; do echo "=========$log========="; grep "error" $log; done - name: JavaStyle with maven run: build/mvn -T 4 spotless:check ${{ matrix.profiles }} -pl '!:kyuubi-codecov_2.12,!:kyuubi-assembly_2.12' - - name: Maven install - # run install after style check because it is expensive, we can skip build if style fails - # Well, sometimes when we introduce a new module, it may 'fail' the style check for missing - # dependency we just create for other module to inherit. - # We can ignore this failure and merge the PR, if we see the style check pass on the new module - # or via a local quick verification. - run: >- - build/mvn -T 4 clean install -Pflink-provided,spark-provided - -Dmaven.javadoc.skip=true -Drat.skip=true -Dscalastyle.skip=true -Dspotless.check.skip -DskipTests - -pl kyuubi-ctl,kyuubi-server,kyuubi-assembly -am - - name: Check dependency list - run: build/dependency.sh