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

lizhanhui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new 877f875  Collect the build results of different language (#199)
877f875 is described below

commit 877f87580fbd745e0dddff971cf49b64fd058046
Author: Aaron Ai <[email protected]>
AuthorDate: Mon Aug 29 20:21:05 2022 +0800

    Collect the build results of different language (#199)
---
 .github/workflows/cpp_build.yml    | 15 ++-------
 .github/workflows/csharp_build.yml | 14 ++-------
 .github/workflows/golang_build.yml | 14 ++-------
 .github/workflows/java_build.yml   | 14 ++-------
 .github/workflows/path_filter.yml  | 62 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 74 insertions(+), 45 deletions(-)

diff --git a/.github/workflows/cpp_build.yml b/.github/workflows/cpp_build.yml
index 666d879..5ee2682 100644
--- a/.github/workflows/cpp_build.yml
+++ b/.github/workflows/cpp_build.yml
@@ -1,18 +1,9 @@
 name: CPP Build
-on:
-  pull_request:
-    types: [opened, reopened, synchronize]
-    paths:
-      - 'cpp/**'
-  push:
-    branches:
-      - master
-      - cpp_dev
-    paths:
-      - 'cpp/**'
+on: 
+  workflow_call:
 jobs:
   cpp_build:
-    name: "CPP (${{ matrix.os }})"
+    name: "${{ matrix.os }}"
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
diff --git a/.github/workflows/csharp_build.yml 
b/.github/workflows/csharp_build.yml
index 514398d..f90f893 100644
--- a/.github/workflows/csharp_build.yml
+++ b/.github/workflows/csharp_build.yml
@@ -1,17 +1,9 @@
 name: C# Build
-on:
-  pull_request:
-    types: [opened, reopened, synchronize]
-    paths:
-      - 'csharp/**'
-  push:
-    branches:
-      - master
-    paths:
-      - 'csharp/**'  
+on: 
+  workflow_call: 
 jobs:
   c_sharp:
-    name: "C# (ubuntu-18.04)"
+    name: "ubuntu-18.04"
     runs-on: ubuntu-18.04
     steps:
       - name: Checkout
diff --git a/.github/workflows/golang_build.yml 
b/.github/workflows/golang_build.yml
index 673625b..3826232 100644
--- a/.github/workflows/golang_build.yml
+++ b/.github/workflows/golang_build.yml
@@ -1,17 +1,9 @@
 name: Golang Build
-on:
-  pull_request:
-    types: [opened, reopened, synchronize]
-    paths:
-      - 'golang/**'
-  push:
-    branches:
-      - master
-    paths:
-      - 'golang/**'
+on: 
+  workflow_call:
 jobs:
   cpp_build:
-    name: "Golang (${{ matrix.os }}, Go ${{ matrix.go }})"
+    name: "${{ matrix.os }}, go-${{ matrix.go }}"
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
diff --git a/.github/workflows/java_build.yml b/.github/workflows/java_build.yml
index ebd9c8e..4fdfcca 100644
--- a/.github/workflows/java_build.yml
+++ b/.github/workflows/java_build.yml
@@ -1,17 +1,9 @@
 name: Java Build
-on:
-  pull_request:
-    types: [opened, reopened, synchronize]
-    paths:
-      - 'java/**'
-  push:
-    branches:
-      - master
-    paths:
-      - 'java/**'
+on: 
+  workflow_call:
 jobs:
   java_build:
-    name: "Java (${{ matrix.os }}, JDK-${{ matrix.jdk }})"
+    name: "${{ matrix.os }}, jdk-${{ matrix.jdk }}"
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
diff --git a/.github/workflows/path_filter.yml 
b/.github/workflows/path_filter.yml
new file mode 100644
index 0000000..1e403a2
--- /dev/null
+++ b/.github/workflows/path_filter.yml
@@ -0,0 +1,62 @@
+name: Build
+on:
+  pull_request:
+    types: [opened, reopened, synchronize]
+  push:
+    branches:
+      - master
+
+jobs:
+  paths-filter:
+    runs-on: ubuntu-latest
+    outputs:
+      java: ${{ steps.filter.outputs.java }}
+      cpp: ${{ steps.filter.outputs.cpp }}
+      golang: ${{ steps.filter.outputs.golang }}
+      csharp: ${{ steps.filter.outputs.csharp }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: dorny/paths-filter@v2
+        id: filter
+        with:
+          filters: |
+            java:
+              - 'java/**'
+            cpp:
+              - 'cpp/**'
+            golang:
+              - 'golang/**'
+            csharp:
+              - 'csharp/**'
+  java-build:
+    needs: [paths-filter]
+    if: ${{ needs.paths-filter.outputs.java == 'true' }}
+    uses: ./.github/workflows/java_build.yml
+  cpp-build:
+    needs: [paths-filter]
+    if: ${{ needs.paths-filter.outputs.cpp == 'true' }}
+    uses: ./.github/workflows/cpp_build.yml
+  csharp-build:
+    needs: [paths-filter]
+    if: ${{ needs.paths-filter.outputs.csharp == 'true' }}
+    uses: ./.github/workflows/csharp_build.yml
+  golang-build:
+    needs: [paths-filter]
+    if: ${{ needs.paths-filter.outputs.golang == 'true' }}
+    uses: ./.github/workflows/golang_build.yml
+  build-result:
+    runs-on: ubuntu-latest
+    needs: [java-build, cpp-build, csharp-build, golang-build]
+    if: ${{ always() }}
+    steps:
+      - uses: actions/checkout@v2
+      - name: Collector build result
+        run: |
+          if echo java-${{ needs.java-build.result }},cpp-${{ 
needs.cpp-build.result }},csharp-${{ needs.csharp-build.result }},golang-${{ 
needs.golang-build.result }} | grep -E 'cancelled|failure' -o > null
+          then
+            echo "There are failed/cancelled builds"
+            exit 1 
+          else
+            echo "All builds are successful/skipped"
+            exit 0
+          fi

Reply via email to