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 9ccca795f51 workflow: add warmup cache strategy for operation e2e
(#38229)
9ccca795f51 is described below
commit 9ccca795f51d190d872ddd6212c04c0d31e6f348
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Fri Feb 27 11:31:08 2026 +0800
workflow: add warmup cache strategy for operation e2e (#38229)
* workflow: warmup cache for operation e2e
* workflow: extract shared maven cache save action
---
.github/workflows/e2e-operation.yml | 9 ++++-
.github/workflows/nightly-e2e-operation.yml | 9 ++++-
.../resources/actions/save-maven-cache/action.yml | 44 ++++++++++++++++++++++
.../actions/setup-build-environment/action.yml | 13 ++++++-
4 files changed, 72 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/e2e-operation.yml
b/.github/workflows/e2e-operation.yml
index 7becf906a78..d86a6eaf6d4 100644
--- a/.github/workflows/e2e-operation.yml
+++ b/.github/workflows/e2e-operation.yml
@@ -57,9 +57,11 @@ jobs:
timeout-minutes: 40
steps:
- uses: actions/[email protected]
- - uses: ./.github/workflows/resources/actions/setup-build-environment
+ - id: setup-build-environment
+ uses: ./.github/workflows/resources/actions/setup-build-environment
with:
cache-suffix: 'e2e-operation'
+ cache-save-enabled: 'false'
- uses: docker/setup-docker-action@v4
with:
version: v28.0.4
@@ -72,6 +74,10 @@ jobs:
FORMATTED_PL=$(echo "$MODULE_LIST" | sed "s|,|,$PREFIX|g" | sed
"s|^|$PREFIX|")
echo "Ready to build: $FORMATTED_PL"
./mvnw -B clean install -am -pl "$FORMATTED_PL" -Pe2e.env.docker
-DskipTests
+ - 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-e2e-artifacts
e2e-operation:
@@ -106,6 +112,7 @@ jobs:
- uses: ./.github/workflows/resources/actions/setup-build-environment
with:
cache-suffix: 'e2e-operation'
+ cache-save-enabled: 'false'
- uses: docker/setup-docker-action@v4
with:
version: v28.0.4
diff --git a/.github/workflows/nightly-e2e-operation.yml
b/.github/workflows/nightly-e2e-operation.yml
index c83aaea824d..e63505828c3 100644
--- a/.github/workflows/nightly-e2e-operation.yml
+++ b/.github/workflows/nightly-e2e-operation.yml
@@ -47,9 +47,11 @@ jobs:
timeout-minutes: 40
steps:
- uses: actions/[email protected]
- - uses: ./.github/workflows/resources/actions/setup-build-environment
+ - id: setup-build-environment
+ uses: ./.github/workflows/resources/actions/setup-build-environment
with:
cache-suffix: 'e2e-operation'
+ cache-save-enabled: 'false'
- uses: docker/setup-docker-action@v4
with:
version: v28.0.4
@@ -62,6 +64,10 @@ jobs:
FORMATTED_PL=$(echo "$MODULE_LIST" | sed "s|,|,$PREFIX|g" | sed
"s|^|$PREFIX|")
echo "Ready to build: $FORMATTED_PL"
./mvnw -B clean install -am -pl "$FORMATTED_PL" -Pe2e.env.docker
-DskipTests
+ - 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-e2e-artifacts
e2e-operation-job:
@@ -101,6 +107,7 @@ jobs:
with:
java-version: ${{ matrix.java-version }}
cache-suffix: 'e2e-operation'
+ cache-save-enabled: 'false'
- uses: docker/setup-docker-action@v4
with:
version: v28.0.4
diff --git a/.github/workflows/resources/actions/save-maven-cache/action.yml
b/.github/workflows/resources/actions/save-maven-cache/action.yml
new file mode 100644
index 00000000000..9d4c4ff2d3a
--- /dev/null
+++ b/.github/workflows/resources/actions/save-maven-cache/action.yml
@@ -0,0 +1,44 @@
+#
+# 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: 'Save Maven Cache'
+description: 'Save Maven cache when restore misses on non-pull-request events'
+
+inputs:
+ cache-hit:
+ description: 'Output cache-hit from restore step'
+ required: true
+ cache-primary-key:
+ description: 'Output cache-primary-key from restore step'
+ required: true
+ enabled:
+ description: 'Whether to enable cache save'
+ required: false
+ default: 'true'
+
+runs:
+ using: composite
+ steps:
+ - name: Save Maven Cache
+ if: github.event_name != 'pull_request' && inputs.enabled == 'true' &&
inputs.cache-hit != 'true'
+ uses: actions/cache/[email protected]
+ with:
+ path: |
+ ~/.m2/repository
+ !~/.m2/repository/org/apache/shardingsphere
+ ~/.m2/repository/org/apache/shardingsphere/elasticjob
+ key: ${{ inputs.cache-primary-key }}
diff --git
a/.github/workflows/resources/actions/setup-build-environment/action.yml
b/.github/workflows/resources/actions/setup-build-environment/action.yml
index 052227ac253..88d1465f238 100644
--- a/.github/workflows/resources/actions/setup-build-environment/action.yml
+++ b/.github/workflows/resources/actions/setup-build-environment/action.yml
@@ -58,10 +58,21 @@ inputs:
Default: 'full'
required: false
default: 'full'
+ cache-save-enabled:
+ description: 'Whether to save Maven cache in this action (default: true)'
+ required: false
+ default: 'true'
github-token:
description: 'GitHub token for GraalVM setup (required when distribution
is graalvm)'
required: false
default: ''
+outputs:
+ cache-hit:
+ description: 'A boolean value to indicate an exact match was found for the
primary key'
+ value: ${{ steps.restore-maven-cache.outputs.cache-hit }}
+ cache-primary-key:
+ description: 'A resolved cache key for which cache match was attempted'
+ value: ${{ steps.restore-maven-cache.outputs.cache-primary-key }}
runs:
using: composite
@@ -95,7 +106,7 @@ runs:
${{ inputs.cache-prefix }}-maven-
${{ inputs.cache-prefix }}-
- name: Save Maven Cache
- if: github.event_name != 'pull_request' &&
steps.restore-maven-cache.outputs.cache-hit != 'true'
+ if: inputs.cache-save-enabled == 'true' && github.event_name !=
'pull_request' && steps.restore-maven-cache.outputs.cache-hit != 'true'
uses: actions/cache/[email protected]
with:
path: |