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

jooks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 622b3fd69 polish ci job filter (#3897)
622b3fd69 is described below

commit 622b3fd69fff3496ea377996d6e8089a0c13d1c9
Author: Liming Deng <[email protected]>
AuthorDate: Tue Aug 30 21:44:56 2022 +0800

    polish ci job filter (#3897)
    
    * polish ci job filter
    
    * fix
    
    * fix
    
    * keep ci job running on shenyu repo
---
 .github/actions/skip-ci/action.yml             | 84 --------------------------
 .github/filters.yml                            | 10 +++
 .github/workflows/ci.yml                       | 16 +++--
 .github/workflows/codeql-analysis.yml          | 12 ++--
 .github/workflows/docker-publish-dockerhub.yml |  1 +
 .github/workflows/docker-publish.yml           | 16 ++---
 .github/workflows/integrated-test.yml          | 26 ++++----
 7 files changed, 45 insertions(+), 120 deletions(-)

diff --git a/.github/actions/skip-ci/action.yml 
b/.github/actions/skip-ci/action.yml
deleted file mode 100644
index 3f1f5e3c4..000000000
--- a/.github/actions/skip-ci/action.yml
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# 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: "Set Skip Env Var"
-description: "Action to set the SKIP_CI environment variable indicating that 
we should skip CI jobs"
-inputs:
-  ignore-patterns:
-    description: >-
-      Set the SKIP_CI environment variable when and only when all the changed 
files located in one of the path,
-      the paths is shell-style pattern.
-    required: false
-    default: >-
-      "*.md"
-      "shenyu-dashboard"
-
-runs:
-  using: "composite"
-  steps:
-    - name: Check Changed Files And Set Env Var
-      shell: bash
-      run: |
-        if [ $GITHUB_BASE_REF ]; then
-          # Pull Request
-          BASE_SHA=$GITHUB_BASE_REF
-        else
-          # Push
-          BASE_SHA=${{ github.event.before }}
-        fi
-
-        echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA"
-
-        if [[ "$BASE_SHA" == "0000000000000000000000000000000000000000" ]]; 
then
-          BASE_SHA="master"
-        fi
-
-        git fetch --no-tags --progress --recurse-submodules --depth=1 origin 
${BASE_SHA}:origin/${BASE_SHA}
-        BASE_SHA=origin/${BASE_SHA}
-        echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA"
-
-        if ! files=$(git --no-pager diff --name-only ${GITHUB_SHA} 
${BASE_SHA}); then
-          exit 1
-        fi
-
-        echo "Ignore pattern:"
-        for pattern in $(echo '${{ inputs.ignore-patterns }}'); do
-          echo $pattern
-        done
-
-        echo "Changed files:"
-        for file in ${files}; do
-          echo $file
-        done
-
-        echo "SKIP_CI=true" >> $GITHUB_ENV
-        for file in ${files}; do
-          matched=0
-          for pattern in $(echo '${{ inputs.ignore-patterns }}'); do
-            pattern=$(echo "$pattern" | sed 's/"//g')
-            if eval "[[ '$file' == $pattern ]]"; then
-              matched=1
-              break
-            fi
-          done
-          if [[ "$matched" == "0" ]]; then
-            echo "$file doesn't match pattern $(echo '${{ 
inputs.ignore-patterns }}'), stop checking"
-            echo "SKIP_CI=false" >> $GITHUB_ENV
-            break
-          fi
-        done
diff --git a/.github/filters.yml b/.github/filters.yml
new file mode 100644
index 000000000..b92bc0e3a
--- /dev/null
+++ b/.github/filters.yml
@@ -0,0 +1,10 @@
+changed:
+  - "!**/{\
+    *.md,*.txt,\
+    resources/static/**,\
+    .asf.yaml,.gitignore,.licenserc.yaml,\
+    LICENSE,NOTICE,\
+    .github/(ISSUE_TEMPLATE/**|PULL_REQUEST_TEMPLATE)\
+    }"
+pom:
+  - "**/pom.xml"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 27d7a9816..8e133a040 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,6 +39,7 @@ jobs:
           - java: 16
             os: ubuntu-latest
     runs-on: ${{ matrix.os }}
+    if: (github.repository == 'apache/shenyu')
     steps:
       - name: Support longpaths
         if: ${{ matrix.os == 'windows-latest'}}
@@ -46,10 +47,13 @@ jobs:
       - uses: actions/checkout@v2
         with:
           submodules: true
-      - name: Set Skip Env Var
-        uses: ./.github/actions/skip-ci
+      - uses: dorny/paths-filter@v2
+        id: filter
+        with:
+          filters: '.github/filters.yml'
+          list-files: json
       - name: Cache Maven Repos
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         uses: actions/cache@v2
         with:
           path: ~/.m2/repository
@@ -57,14 +61,14 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-maven-
       - uses: actions/setup-java@v1
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         with:
           java-version: ${{ matrix.java }}
       - name: Build with Maven
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: ./mvnw -B clean install -Prelease
       - uses: codecov/codecov-action@v1
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
 
   check-license-header:
     name: Check License Header
diff --git a/.github/workflows/codeql-analysis.yml 
b/.github/workflows/codeql-analysis.yml
index 402ce61a4..abb5ded53 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -19,12 +19,17 @@ on:
   push:
     branches:
       - master
+    paths:
+      - '**/*.java'
   pull_request:
+    paths:
+      - '**/*.java'
 
 jobs:
   analyze:
     name: Analyze
     runs-on: ubuntu-latest
+    if: (github.repository == 'apache/shenyu')
 
     strategy:
       fail-fast: false
@@ -36,17 +41,13 @@ jobs:
         uses: actions/checkout@v2
         with:
           submodules: true
-      - name: Set Skip Env Var
-        uses: ./.github/actions/skip-ci
       - name: Set up JDK 1.8
         uses: actions/setup-java@v1
-        if: env.SKIP_CI != 'true'
         with:
           java-version: 1.8
 
       - name: Cache local Maven repository
         uses: actions/cache@v2
-        if: env.SKIP_CI != 'true'
         with:
           path: ~/.m2/repository
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -55,14 +56,11 @@ jobs:
 
       - name: Initialize CodeQL
         uses: github/codeql-action/init@v1
-        if: env.SKIP_CI != 'true'
         with:
           languages: ${{ matrix.language }}
 
       - name: Autobuild
         uses: github/codeql-action/autobuild@v1
-        if: env.SKIP_CI != 'true'
 
       - name: Perform CodeQL Analysis
         uses: github/codeql-action/analyze@v1
-        if: env.SKIP_CI != 'true'
diff --git a/.github/workflows/docker-publish-dockerhub.yml 
b/.github/workflows/docker-publish-dockerhub.yml
index a52f4bdf7..56ac47cd5 100644
--- a/.github/workflows/docker-publish-dockerhub.yml
+++ b/.github/workflows/docker-publish-dockerhub.yml
@@ -28,6 +28,7 @@ env:
 jobs:
   dockerhub:
     runs-on: ubuntu-latest
+    if: (github.repository == 'apache/shenyu')
     permissions:
       contents: read
       packages: write
diff --git a/.github/workflows/docker-publish.yml 
b/.github/workflows/docker-publish.yml
index 30c26a296..890962b5c 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -19,6 +19,9 @@ on:
   push:
     branches: [ "master" ]
     tags: [ 'v*.*.*' ]
+    paths:
+      - '!**.md'
+      - '!**/resources/static/'
 
 env:
   REGISTRY: ghcr.io
@@ -28,6 +31,7 @@ env:
 jobs:
   build:
     runs-on: ubuntu-latest
+    if: (github.repository == 'apache/shenyu')
     permissions:
       contents: read
       packages: write
@@ -38,12 +42,8 @@ jobs:
         with:
           submodules: true
 
-      - name: Set Skip Env Var
-        uses: ./.github/actions/skip-ci
-
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v2
-        if: env.SKIP_CI != 'true'
         with:
           registry: ${{ env.REGISTRY }}
           username: ${{ github.actor }}
@@ -51,18 +51,14 @@ jobs:
 
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v2
-        if: env.SKIP_CI != 'true'
 
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v2
-        if: env.SKIP_CI != 'true'
 
       - name: Available platforms
         run: echo ${{ steps.buildx.outputs.platforms }}
-        if: env.SKIP_CI != 'true'
 
       - name: Cache Maven Repos
-        if: env.SKIP_CI != 'true'
         uses: actions/cache@v2
         with:
           path: ~/.m2/repository
@@ -71,17 +67,14 @@ jobs:
             ${{ runner.os }}-maven-
 
       - uses: actions/setup-java@v1
-        if: env.SKIP_CI != 'true'
         with:
           java-version: 8
 
       - name: Build with Maven
-        if: env.SKIP_CI != 'true'
         run: ./mvnw -B clean -Prelease -Dmaven.javadoc.skip=true -B 
-Drat.skip=true -Djacoco.skip=true -DskipITs -DskipTests package
 
       - name: Build and push (admin) (ghcr.io)
         uses: docker/build-push-action@v3
-        if: env.SKIP_CI != 'true'
         with:
           context: ./shenyu-dist/shenyu-admin-dist
           build-args: APP_NAME=apache-shenyu-*-admin-bin
@@ -93,7 +86,6 @@ jobs:
 
       - name: Build and push (bootstrap) (ghcr.io)
         uses: docker/build-push-action@v3
-        if: env.SKIP_CI != 'true'
         with:
           context: ./shenyu-dist/shenyu-bootstrap-dist
           build-args: APP_NAME=apache-shenyu-*-bootstrap-bin
diff --git a/.github/workflows/integrated-test.yml 
b/.github/workflows/integrated-test.yml
index f4313b6cb..38f9637c7 100644
--- a/.github/workflows/integrated-test.yml
+++ b/.github/workflows/integrated-test.yml
@@ -37,14 +37,18 @@ jobs:
           - shenyu-integrated-test-websocket
           - shenyu-integrated-test-combination
     runs-on: ubuntu-latest
+    if: (github.repository == 'apache/shenyu')
     steps:
       - uses: actions/checkout@v2
         with:
           submodules: true
-      - name: Set Skip Env Var
-        uses: ./.github/actions/skip-ci
+      - uses: dorny/paths-filter@v2
+        id: filter
+        with:
+          filters: '.github/filters.yml'
+          list-files: json
       - name: Cache Maven Repos
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         uses: actions/cache@v2
         with:
           path: ~/.m2/repository
@@ -52,31 +56,31 @@ jobs:
           restore-keys: |
             ${{ runner.os }}-maven-
       - uses: actions/setup-java@v1
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         with:
           java-version: 8
       - name: Build with Maven
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: ./mvnw -B clean install -Prelease,docker 
-Dmaven.javadoc.skip=true -Dmaven.test.skip=true
       - name: Build examples
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: ./mvnw -B clean install -Pexample -Dmaven.javadoc.skip=true 
-Dmaven.test.skip=true -f ./shenyu-examples/pom.xml
       - name: Build integrated tests
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: ./mvnw -B clean install -Pit -DskipTests -f 
./shenyu-integrated-test/pom.xml
       - name: Start docker compose
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: docker-compose -f ./shenyu-integrated-test/${{ matrix.case 
}}/docker-compose.yml up -d
       - name: Wait for docker compose start up completely
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: bash ./shenyu-integrated-test/${{ matrix.case 
}}/script/healthcheck.sh
       - name: Run test
         id: test
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: ./mvnw test -Pit -f ./shenyu-integrated-test/${{ matrix.case 
}}/pom.xml
         continue-on-error: true
       - name: Check test result
-        if: env.SKIP_CI != 'true'
+        if: steps.filter.outputs.changed == 'true'
         run: |
           docker-compose -f ./shenyu-integrated-test/${{ matrix.case 
}}/docker-compose.yml logs --tail="all"
           if [[ ${{steps.test.outcome}} == "failure" ]]; then

Reply via email to