Explorar o código

Fix cache is overriden randomly after build and before tests (#14808)

* Fix cache is overriden randomly after build and before tests
* Update backend.yml
* Update unit-test.yml
kezhenxu94 hai 1 ano
pai
achega
294a6225f1

+ 3 - 4
.github/workflows/api-test.yml

@@ -60,7 +60,7 @@ jobs:
         uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-api-test
           restore-keys: ${{ runner.os }}-maven-
       - name: Build Image
         run: |
@@ -68,8 +68,7 @@ jobs:
           -Dmaven.test.skip \
           -Dmaven.javadoc.skip \
           -Dspotless.skip=true \
-          -Pdocker,release -Ddocker.tag=ci \
-          -pl dolphinscheduler-standalone-server -am
+          -Pdocker,release -Ddocker.tag=ci
       - name: Export Docker Images
         run: |
           docker save apache/dolphinscheduler-standalone-server:ci -o /tmp/standalone-image.tar \
@@ -112,7 +111,7 @@ jobs:
         uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-api-test
           restore-keys: ${{ runner.os }}-maven-
       - uses: actions/download-artifact@v2
         name: Download Docker Images

+ 2 - 1
.github/workflows/backend.yml

@@ -75,7 +75,8 @@ jobs:
       - uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-backend
+          restore-keys: ${{ runner.os }}-maven-
       - name: Build and Package on ${{ matrix.java }}
         run: |
           ./mvnw -B clean install \

+ 3 - 3
.github/workflows/e2e.yml

@@ -60,7 +60,7 @@ jobs:
         uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-e2e
           restore-keys: ${{ runner.os }}-maven-
       - name: Build Image
         run: |
@@ -130,7 +130,7 @@ jobs:
         uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-e2e
           restore-keys: ${{ runner.os }}-maven-
       - uses: actions/download-artifact@v2
         name: Download Docker Images
@@ -174,7 +174,7 @@ jobs:
         uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-e2e
           restore-keys: ${{ runner.os }}-maven-
       - uses: actions/download-artifact@v2
         name: Download Docker Images

+ 2 - 3
.github/workflows/publish-docker.yaml

@@ -38,9 +38,8 @@ jobs:
         uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-docker
+          restore-keys: ${{ runner.os }}-maven-
       - name: Set environment variables
         run: |
           if [[ ${{ github.event_name }} == "release" ]]; then

+ 2 - 1
.github/workflows/unit-test.yml

@@ -72,7 +72,8 @@ jobs:
       - uses: actions/cache@v3
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-unit-test
+          restore-keys: ${{ runner.os }}-maven-
 
       - name: Run Unit tests
         run: ./mvnw clean verify -B -Dmaven.test.skip=false -Dspotless.skip=true