sandynz commented on issue #38192:
URL: 
https://github.com/apache/shardingsphere/issues/38192#issuecomment-3958904275

   ### Updates
   
   #### 1. `cache-suffix` Parameter
   
   **Design Purpose:**
   - Support cache isolation for different build scopes, optimizing cache hit 
rate and storage efficiency
   - Allow independent cache spaces for different build types (full build, E2E 
tests, etc.)
   
   **Parameter Values:**
   
   | Value | Usage Scenario |
   |---|---|
   | `full` | Full build (default) |
   | `e2e-sql` | E2E SQL tests |
   | `e2e-agent` | E2E Agent tests |
   | `e2e-operation` | E2E Operation tests |
   
   **Cache Key Format:**
   ```
   {cache-prefix}-maven-{cache-suffix}-{hashFiles('**/pom.xml')}
   ```
   
   **Restore Keys Strategy (Multi-level Fallback):**
   ```
   1. {cache-prefix}-maven-{cache-suffix}-
   2. {cache-prefix}-maven-full-
   3. {cache-prefix}-maven-
   4. {cache-prefix}-
   ```
   
   #### 2. Shared Composite Actions
   
   **New Actions:**
   
   | Action | Purpose |
   |---|---|
   | `setup-build-environment` | Unified Java and Maven cache setup |
   
   **setup-build-environment Parameters:**
   
   | Parameter | Required | Default | Description |
   |---|---|---|---|
   | `java-version` | No | `17` | Java version |
   | `distribution` | No | `temurin` | Java distribution |
   | `cache-prefix` | No | `apache-shardingsphere` | Cache key prefix |
   | `cache-suffix` | No | `full` | Cache key suffix |
   
   **Why use `actions/cache` instead of `setup-java` built-in cache:**
   - Precise control over cache paths, excluding project's own built jars 
(`!~/.m2/repository/org/apache/shardingsphere`)
   - Avoid cache pollution and reduce cache size
   
   #### 3. Remove `github.sha` from Cache Key
   
   e.g.
   **Original Key:**
   ```
   apache-shardingsphere-maven-third-party-e2e-cache-${{ github.sha }}
   ```
   
   **New Key:**
   ```
   apache-shardingsphere-maven-e2e-sql-{pom.xml hash}
   ```
   
   **Benefits:**
   - Improved cache hit rate (different commits can reuse the same dependency 
cache)
   - Reduced cache storage pressure (avoid creating isolated cache for each 
commit)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to