This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 3955bdcf2cc Add : add job runnable check (#27488)
3955bdcf2cc is described below
commit 3955bdcf2cc2d73d900e351840ee7c9eecfb24e4
Author: 孙念君 Nianjun Sun <[email protected]>
AuthorDate: Thu Jul 27 00:18:09 2023 +0800
Add : add job runnable check (#27488)
* Add : add job runnable check
* Refactor : refactor the check-job-executable step (#27488)
* Add : add more job runnable check (#27488)
* Refactor : speed up the checkout for environment init (#27488)
---
.github/workflows/ci.yml | 1 +
.github/workflows/e2e-agent.yml | 1 +
.github/workflows/e2e-operation.yml | 3 ++-
.github/workflows/e2e-sql.yml | 3 ++-
.github/workflows/required-check.yml | 10 ++++++++++
.github/workflows/required-reusable.yml | 12 ++++++++++++
.../workflows/resources/variables/env-variables.properties | 1 +
7 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7749dec0338..a4ce781c276 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -61,6 +61,7 @@ jobs:
ci:
name: CI - Compile by JDK 11 and Run on JDK 8
needs: global-env
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
diff --git a/.github/workflows/e2e-agent.yml b/.github/workflows/e2e-agent.yml
index 04e423358f1..19891434b43 100644
--- a/.github/workflows/e2e-agent.yml
+++ b/.github/workflows/e2e-agent.yml
@@ -63,6 +63,7 @@ jobs:
agent-mysql:
name: E2E - Agent with MySQL
needs: global-env
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
diff --git a/.github/workflows/e2e-operation.yml
b/.github/workflows/e2e-operation.yml
index 343d9267685..ef3d7840766 100644
--- a/.github/workflows/e2e-operation.yml
+++ b/.github/workflows/e2e-operation.yml
@@ -50,8 +50,9 @@ jobs:
changed_operations: ${{ steps.filter.outputs.changes }}
e2e-operation:
- needs: [ detect-changed-files, global-env ]
name: E2E - ${{ matrix.operation }} on ${{ matrix.image.version }}
+ needs: [ detect-changed-files, global-env ]
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
diff --git a/.github/workflows/e2e-sql.yml b/.github/workflows/e2e-sql.yml
index 4ebd7217a4d..ee73745216c 100644
--- a/.github/workflows/e2e-sql.yml
+++ b/.github/workflows/e2e-sql.yml
@@ -97,9 +97,10 @@ jobs:
e2e-sql:
name: E2E - ${{ matrix.adapter }} - ${{ matrix.scenario }} - ${{
matrix.mode }} on ${{ matrix.database }}
+ needs: [ build-e2e-image, global-env ]
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 15
- needs: [ build-e2e-image, global-env ]
strategy:
max-parallel: 20
fail-fast: false
diff --git a/.github/workflows/required-check.yml
b/.github/workflows/required-check.yml
index 608f5d00284..4f4892fc5c1 100644
--- a/.github/workflows/required-check.yml
+++ b/.github/workflows/required-check.yml
@@ -27,8 +27,14 @@ concurrency:
cancel-in-progress: true
jobs:
+ global-env:
+ name: Import Global Env
+ uses: ./.github/workflows/required-reusable.yml
+
check-checkstyle:
name: Check - CheckStyle
+ needs: global-env
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@@ -38,6 +44,8 @@ jobs:
check-spotless:
name: Check - Spotless
+ needs: global-env
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
@@ -47,6 +55,8 @@ jobs:
check-license:
name: Check - License
+ needs: global-env
+ if: ${{ needs.global-env.outputs.GLOBAL_IS_JOB_EXECUTABLE == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
diff --git a/.github/workflows/required-reusable.yml
b/.github/workflows/required-reusable.yml
index 094428641ed..5915bee2cc0 100644
--- a/.github/workflows/required-reusable.yml
+++ b/.github/workflows/required-reusable.yml
@@ -22,12 +22,17 @@ on:
outputs:
GLOBAL_REPOSITORY_NAME:
value: ${{ jobs.init-environment.outputs.GLOBAL_REPOSITORY_NAME }}
+ GLOBAL_IS_JOB_EXECUTABLE:
+ value: ${{ jobs.init-environment.outputs.GLOBAL_IS_JOB_EXECUTABLE }}
jobs:
init-environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
+ with:
+ sparse-checkout: |
+ .github/workflows/resources/variables/
- name: Setup Environment
id: import-variables
run: |
@@ -35,5 +40,12 @@ jobs:
do
echo ${line} >> $GITHUB_OUTPUT
done
+ - name: Check If Job is Executable
+ id: check-job-executable
+ run: |
+ if [ ${{ toJSON(github.repository) }} = ${{
steps.import-variables.outputs.GLOBAL_REPOSITORY }} ]; then
+ echo "GLOBAL_IS_JOB_EXECUTABLE=true" >> $GITHUB_OUTPUT
+ fi
outputs:
GLOBAL_REPOSITORY_NAME: ${{
steps.import-variables.outputs.GLOBAL_REPOSITORY_NAME }}
+ GLOBAL_IS_JOB_EXECUTABLE: ${{
steps.check-job-executable.outputs.GLOBAL_IS_JOB_EXECUTABLE }}
diff --git a/.github/workflows/resources/variables/env-variables.properties
b/.github/workflows/resources/variables/env-variables.properties
index 74237410375..19bd23192c4 100644
--- a/.github/workflows/resources/variables/env-variables.properties
+++ b/.github/workflows/resources/variables/env-variables.properties
@@ -1 +1,2 @@
+GLOBAL_REPOSITORY=apache/shardingsphere
GLOBAL_REPOSITORY_NAME=shardingsphere