You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/07/28 00:32:38 UTC

[doris] branch master updated: [enhancement](workflow) Optimize workflows (#11145)

This is an automated email from the ASF dual-hosted git repository.

morningman 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 9013d5cc09 [enhancement](workflow) Optimize workflows (#11145)
9013d5cc09 is described below

commit 9013d5cc094b040d36ff356bac603b182041e7f4
Author: Adonis Ling <ad...@gmail.com>
AuthorDate: Thu Jul 28 08:32:33 2022 +0800

    [enhancement](workflow) Optimize workflows (#11145)
    
    1. Fine tune the trigger conditions for workflows.
    2. Introduce concurrency group to cancel previous workflow trigged by the same pr.
---
 .github/actions/paths-filter                       |   1 +
 .../workflows/{clang-build.yml => be-ut-clang.yml} |  41 +++++---
 .github/workflows/build-extension.yml              | 105 ++++++++++++++-------
 .github/workflows/clang-format.yml                 |  16 ++++
 .gitmodules                                        |   3 +
 5 files changed, 119 insertions(+), 47 deletions(-)

diff --git a/.github/actions/paths-filter b/.github/actions/paths-filter
new file mode 160000
index 0000000000..b2feaf19c2
--- /dev/null
+++ b/.github/actions/paths-filter
@@ -0,0 +1 @@
+Subproject commit b2feaf19c27470162a626bd6fa8438ae5b263721
diff --git a/.github/workflows/clang-build.yml b/.github/workflows/be-ut-clang.yml
similarity index 71%
rename from .github/workflows/clang-build.yml
rename to .github/workflows/be-ut-clang.yml
index 08a7fb824a..d25e6a9d17 100644
--- a/.github/workflows/clang-build.yml
+++ b/.github/workflows/be-ut-clang.yml
@@ -15,21 +15,38 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: Clang Build
+name: BE UT (Clang)
 
-on: [push, pull_request]
+on:
+  pull_request:
+
+concurrency:
+  group: ${{ github.head_ref || github.ref_name }} (BE UT Clang)
+  cancel-in-progress: true
 
 jobs:
-  build:
-    strategy:
-      matrix:
-        type: [build, ut]
+  run-ut:
+    name: BE UT (Clang)
     runs-on: ubuntu-20.04
     steps:
       - name: Checkout
         uses: actions/checkout@v3
+        with:
+          persist-credentials: false
+          submodules: recursive
+
+      - name: Paths filter
+        uses: ./.github/actions/paths-filter
+        id: filter
+        with:
+          filters: |
+            be_changes:
+              - 'be/**'
+              - 'gensrc/proto/**'
+              - 'gensrc/thrift/**'
 
-      - name: Run ${{ matrix.type }}
+      - name: Run UT
+        if: ${{ steps.filter.outputs.be_changes == 'true' }}
         run: |
           export DEFAULT_DIR='/opt/doris'
           export PATH="${DEFAULT_DIR}/ldb-toolchain/bin/:${DEFAULT_DIR}/thirdparty/installed/bin/:${PATH}"
@@ -53,8 +70,8 @@ jobs:
           sudo ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
           sudo dpkg-reconfigure --frontend noninteractive tzdata
 
-          if [[ "${{ matrix.type }}" == 'build' ]]; then
-            DORIS_TOOLCHAIN=clang ./build.sh -j "$(nproc)" --be --clean
-          else
-            DORIS_TOOLCHAIN=clang ./run-be-ut.sh -j "$(nproc)" --run --clean
-          fi
+          DORIS_TOOLCHAIN=clang ./run-be-ut.sh -j "$(nproc)" --run --clean
+
+      - name: Skip UT
+        if: ${{ steps.filter.outputs.be_changes == 'false' }}
+        run: echo 'No need to run.'
diff --git a/.github/workflows/build-extension.yml b/.github/workflows/build-extension.yml
index e707915c3f..4d5364591d 100644
--- a/.github/workflows/build-extension.yml
+++ b/.github/workflows/build-extension.yml
@@ -17,45 +17,80 @@
 #
 ---
 name: Build Extensions
+
 on:
   pull_request:
-  push:
+
+concurrency:
+  group: ${{ github.head_ref || github.ref_name }} (Build Extensions)
+  cancel-in-progress: true
 
 jobs:
-  build-extension:
-    name: "Build Extensions"
+  changes:
+    name: Detect changes
+    runs-on: ubuntu-latest
+    outputs:
+      broker_changes: ${{ steps.filter.outputs.broker_changes }}
+      docs_changes: ${{ steps.filter.outputs.docs_changes }}
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          persist-credentials: false
+          submodules: recursive
+
+      - name: Paths filter
+        uses: ./.github/actions/paths-filter
+        id: filter
+        with:
+          filters: |
+            broker_changes:
+              - 'fs_brokers/**'
+            docs_changes:
+              - 'docs/**'
+
+  build-broker:
+    name: Build Broker
+    needs: changes
+    if: ${{ needs.changes.outputs.broker_changes == 'true' }}
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Setup java
+        uses: actions/setup-java@v2
+        with:
+          distribution: adopt
+          java-version: '8'
+
+      - name: Setup thrift
+        run: |
+          sudo apt-get update
+          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y thrift-compiler=0.13.0-2build2
+          thrift --version
+          mkdir -p thirdparty/installed/bin/
+          cd thirdparty/installed/bin/ && ln -s /usr/bin/thrift thrift
+
+      - name: Build broker
+        run: |
+          cd fs_brokers/apache_hdfs_broker/ && /bin/bash build.sh
+
+  build-docs:
+    name: Build Documents
+    needs: changes
+    if: ${{ needs.changes.outputs.docs_changes == 'true' }}
     runs-on: ubuntu-latest
-    defaults:
-      run:
-        shell: bash
     steps:
-    - name: Checkout
-      uses: actions/checkout@master
-
-    - name: Setup Node.js
-      uses: actions/setup-node@v1
-      with:
-        node-version: 16.14.0
-
-    - name: Setup java
-      uses: actions/setup-java@v2
-      with:
-        distribution: adopt
-        java-version: '8'
-
-    - name: Setup thrift
-      run: |
-        sudo apt-get update
-        sudo DEBIAN_FRONTEND=noninteractive apt-get install -y thrift-compiler=0.13.0-2build2
-        thrift --version
-        mkdir -p thirdparty/installed/bin/
-        cd thirdparty/installed/bin/ && ln -s /usr/bin/thrift thrift
-
-    - name: Build broker
-      run: |
-        cd fs_brokers/apache_hdfs_broker/ && /bin/bash build.sh
-
-    - name: Build docs
-      run: |
-        cd docs &&  /bin/bash build_help_zip.sh && export NODE_OPTIONS="--max-old-space-size=8192" && npm install && npm run build
+      - name: Checkout
+        uses: actions/checkout@v3
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v1
+        with:
+          node-version: 16.14.0
+
+      - name: Build docs
+        run: |
+          cd docs &&  /bin/bash build_help_zip.sh && export NODE_OPTIONS="--max-old-space-size=8192" && npm install && npm run build
 
diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml
index a8f9e61677..9884cf0789 100644
--- a/.github/workflows/clang-format.yml
+++ b/.github/workflows/clang-format.yml
@@ -21,6 +21,7 @@ name: BE Code Formatter
 on:
   pull_request:
   push:
+
 jobs:
   clang-format:
     name: "Clang Formatter"
@@ -31,10 +32,25 @@ jobs:
         with:
           persist-credentials: false
           submodules: recursive
+
+      - name: Paths filter
+        uses: ./.github/actions/paths-filter
+        id: filter
+        with:
+          filters: |
+            be_changes:
+              - 'be/src/**'
+              - 'be/test/**'
+
       - name: "Format it!"
+        if: ${{ steps.filter.outputs.be_changes == 'true' }}
         uses: ./.github/actions/clang-format-lint-action
         id: be_clang_format
         with:
           source: 'be/src be/test'
           clangFormatVersion: 13
           inplace: False
+
+      - name: Ignore it!
+        if: ${{ steps.filter.outputs.be_changes == 'false' }}
+        run: echo 'No need to check.'
diff --git a/.gitmodules b/.gitmodules
index bf839a8ae4..987c2ea0a6 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,3 +10,6 @@
 [submodule ".github/actions/setup-maven"]
 	path = .github/actions/setup-maven
 	url = https://github.com/stCarolas/setup-maven.git
+[submodule ".github/actions/paths-filter"]
+	path = .github/actions/paths-filter
+	url = https://github.com/dorny/paths-filter


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org