You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/03/17 01:38:10 UTC

(shardingsphere) branch master updated: workflow: extract source snapshot actions and refactor E2E workflows to reuse them (#38467)

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

zhonghongsheng 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 a5ef35113e6 workflow: extract source snapshot actions and refactor E2E workflows to reuse them (#38467)
a5ef35113e6 is described below

commit a5ef35113e6f7423348fd48e713392adf23f25c5
Author: Hongsheng Zhong <zh...@apache.org>
AuthorDate: Tue Mar 17 09:38:02 2026 +0800

    workflow: extract source snapshot actions and refactor E2E workflows to reuse them (#38467)
    
    * Remove unused source snapshot from detect-remaining-matrix job
    
    * Extract source snapshot upload/download to composite actions
    
    * Refactor nightly-e2e-sql.yml to reuse source snapshot actions
    
    * Refactor e2e-operation workflows to reuse source snapshot actions
    
    * Move upload-source-snapshot after save-maven-cache for clarity
    
    * Inline download-source-snapshot since local action requires checkout first
    
    * Add source snapshot download for detect-remaining-matrix job
---
 .github/workflows/e2e-operation.yml                | 10 +++++--
 .github/workflows/e2e-sql.yml                      | 21 +++++---------
 .github/workflows/nightly-e2e-operation.yml        |  9 +++++-
 .github/workflows/nightly-e2e-sql.yml              |  9 +++++-
 .../actions/upload-source-snapshot/action.yml      | 32 ++++++++++++++++++++++
 5 files changed, 63 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/e2e-operation.yml b/.github/workflows/e2e-operation.yml
index ddf8d08dc6d..62eef4974c9 100644
--- a/.github/workflows/e2e-operation.yml
+++ b/.github/workflows/e2e-operation.yml
@@ -80,6 +80,7 @@ jobs:
         with:
           cache-hit: ${{ steps.setup-build-environment.outputs.cache-hit }}
           cache-primary-key: ${{ steps.setup-build-environment.outputs.cache-primary-key }}
+      - uses: ./.github/workflows/resources/actions/upload-source-snapshot
       - uses: ./.github/workflows/resources/actions/upload-e2e-artifacts
 
   e2e-operation:
@@ -109,8 +110,13 @@ jobs:
           - operation: showprocesslist
             image: { type: "e2e.docker.database.opengauss.images", version: "opengauss/opengauss:3.1.0" }
     steps:
-      - name: Checkout Project
-        uses: actions/checkout@v6.0.1
+      - name: Download Source Snapshot
+        uses: actions/download-artifact@v4
+        with:
+          name: source-snapshot
+          path: /tmp/source-snapshot
+      - name: Restore Source Snapshot
+        run: tar -xzf /tmp/source-snapshot/source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
       - uses: ./.github/workflows/resources/actions/setup-build-environment
         with:
           cache-suffix: 'e2e-operation'
diff --git a/.github/workflows/e2e-sql.yml b/.github/workflows/e2e-sql.yml
index cfd73096d71..5d7f8d96bb1 100644
--- a/.github/workflows/e2e-sql.yml
+++ b/.github/workflows/e2e-sql.yml
@@ -123,18 +123,11 @@ jobs:
           enable-docker-setup: 'true'
       - name: Build E2E Image
         run: ./mvnw -B clean install -am -pl test/e2e/sql -Pe2e.env.docker -DskipTests -Dspotless.apply.skip=true
-      - name: Create Source Snapshot
-        run: git archive --format=tar.gz --output=/tmp/e2e-sql-source-snapshot.tar.gz HEAD -- . ':(exclude)docs'
-      - name: Upload Source Snapshot
-        uses: actions/upload-artifact@v6
-        with:
-          name: e2e-sql-source-snapshot
-          path: /tmp/e2e-sql-source-snapshot.tar.gz
-          retention-days: 3
       - uses: ./.github/workflows/resources/actions/save-maven-cache
         with:
           cache-hit: ${{ steps.setup-build-environment.outputs.cache-hit }}
           cache-primary-key: ${{ steps.setup-build-environment.outputs.cache-primary-key }}
+      - uses: ./.github/workflows/resources/actions/upload-source-snapshot
       - uses: ./.github/workflows/resources/actions/upload-e2e-artifacts
 
   e2e-sql-smoke:
@@ -151,10 +144,10 @@ jobs:
       - name: Download Source Snapshot
         uses: actions/download-artifact@v4
         with:
-          name: e2e-sql-source-snapshot
+          name: source-snapshot
           path: /tmp/source-snapshot
       - name: Restore Source Snapshot
-        run: tar -xzf /tmp/source-snapshot/e2e-sql-source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
+        run: tar -xzf /tmp/source-snapshot/source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
       - uses: ./.github/workflows/resources/actions/setup-build-environment
         with:
           cache-suffix: 'e2e-sql'
@@ -182,10 +175,10 @@ jobs:
       - name: Download Source Snapshot
         uses: actions/download-artifact@v4
         with:
-          name: e2e-sql-source-snapshot
+          name: source-snapshot
           path: /tmp/source-snapshot
       - name: Restore Source Snapshot
-        run: tar -xzf /tmp/source-snapshot/e2e-sql-source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
+        run: tar -xzf /tmp/source-snapshot/source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
       - name: Detect Remaining Matrix
         id: generate
         env:
@@ -220,10 +213,10 @@ jobs:
       - name: Download Source Snapshot
         uses: actions/download-artifact@v4
         with:
-          name: e2e-sql-source-snapshot
+          name: source-snapshot
           path: /tmp/source-snapshot
       - name: Restore Source Snapshot
-        run: tar -xzf /tmp/source-snapshot/e2e-sql-source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
+        run: tar -xzf /tmp/source-snapshot/source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
       - uses: ./.github/workflows/resources/actions/setup-build-environment
         with:
           cache-suffix: 'e2e-sql'
diff --git a/.github/workflows/nightly-e2e-operation.yml b/.github/workflows/nightly-e2e-operation.yml
index 9131b7537d5..6eb113f4756 100644
--- a/.github/workflows/nightly-e2e-operation.yml
+++ b/.github/workflows/nightly-e2e-operation.yml
@@ -68,6 +68,7 @@ jobs:
         with:
           cache-hit: ${{ steps.setup-build-environment.outputs.cache-hit }}
           cache-primary-key: ${{ steps.setup-build-environment.outputs.cache-primary-key }}
+      - uses: ./.github/workflows/resources/actions/upload-source-snapshot
       - uses: ./.github/workflows/resources/actions/upload-e2e-artifacts
 
   e2e-operation-job:
@@ -108,7 +109,13 @@ jobs:
           - operation: showprocesslist
             image: { type: "e2e.docker.database.opengauss.images", version: "opengauss/opengauss:3.1.0" }
     steps:
-      - uses: actions/checkout@v6.0.1
+      - name: Download Source Snapshot
+        uses: actions/download-artifact@v4
+        with:
+          name: source-snapshot
+          path: /tmp/source-snapshot
+      - name: Restore Source Snapshot
+        run: tar -xzf /tmp/source-snapshot/source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
       - uses: ./.github/workflows/resources/actions/setup-build-environment
         with:
           java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/nightly-e2e-sql.yml b/.github/workflows/nightly-e2e-sql.yml
index b68df6ab17a..8184b56a062 100644
--- a/.github/workflows/nightly-e2e-sql.yml
+++ b/.github/workflows/nightly-e2e-sql.yml
@@ -58,6 +58,7 @@ jobs:
         with:
           cache-hit: ${{ steps.setup-build-environment.outputs.cache-hit }}
           cache-primary-key: ${{ steps.setup-build-environment.outputs.cache-primary-key }}
+      - uses: ./.github/workflows/resources/actions/upload-source-snapshot
       - uses: ./.github/workflows/resources/actions/upload-e2e-artifacts
   
   e2e-sql:
@@ -101,7 +102,13 @@ jobs:
             mode: Standalone
             scenario: passthrough
     steps:
-      - uses: actions/checkout@v6.0.1
+      - name: Download Source Snapshot
+        uses: actions/download-artifact@v4
+        with:
+          name: source-snapshot
+          path: /tmp/source-snapshot
+      - name: Restore Source Snapshot
+        run: tar -xzf /tmp/source-snapshot/source-snapshot.tar.gz -C "$GITHUB_WORKSPACE"
       - uses: ./.github/workflows/resources/actions/setup-build-environment
         with:
           java-version: 21
diff --git a/.github/workflows/resources/actions/upload-source-snapshot/action.yml b/.github/workflows/resources/actions/upload-source-snapshot/action.yml
new file mode 100644
index 00000000000..1eef9ae066d
--- /dev/null
+++ b/.github/workflows/resources/actions/upload-source-snapshot/action.yml
@@ -0,0 +1,32 @@
+#
+# 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: 'Upload Source Snapshot'
+description: 'Create and upload source snapshot to avoid repeated checkout'
+
+runs:
+  using: composite
+  steps:
+    - name: Create Source Snapshot
+      shell: bash
+      run: git archive --format=tar.gz --output=/tmp/source-snapshot.tar.gz HEAD -- . ':(exclude)docs'
+    - name: Upload Source Snapshot
+      uses: actions/upload-artifact@v6
+      with:
+        name: source-snapshot
+        path: /tmp/source-snapshot.tar.gz
+        retention-days: 3