From 294a6225f151cc522b87f6b7c4874916aa778bb6 Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Thu, 24 Aug 2023 22:27:24 +0800 Subject: [PATCH] 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 --- .github/workflows/api-test.yml | 7 +++---- .github/workflows/backend.yml | 3 ++- .github/workflows/e2e.yml | 6 +++--- .github/workflows/publish-docker.yaml | 5 ++--- .github/workflows/unit-test.yml | 3 ++- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml index 3de6dcdc7d..fd39bd0977 100644 --- a/.github/workflows/api-test.yml +++ b/.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 diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index ee27ed5e70..1240142f29 100644 --- a/.github/workflows/backend.yml +++ b/.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 \ diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index be46f4fb48..13c878dee7 100644 --- a/.github/workflows/e2e.yml +++ b/.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 diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml index 0ed0b99149..06aa8c6950 100644 --- a/.github/workflows/publish-docker.yaml +++ b/.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 diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 487b0e5ce9..2baacc76ce 100644 --- a/.github/workflows/unit-test.yml +++ b/.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