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

progers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 477bc424d9 Fix GHA tests cache hit miss scenario (#13772)
477bc424d9 is described below

commit 477bc424d93ad5302049e2545988a06f24372983
Author: Tejaswini Bandlamudi <[email protected]>
AuthorDate: Fri Feb 10 22:27:45 2023 +0530

    Fix GHA tests cache hit miss scenario (#13772)
    
    * rebuild maven project or docker image in case of cache hit miss
    * rebuild maven project in case of docker cache hit miss too
    * fix docker-restore cache hit fail issue
---
 .github/workflows/reusable-revised-its.yml  | 28 +++++++++++++++++++++++++---
 .github/workflows/reusable-standard-its.yml |  7 +++++--
 .github/workflows/reusable-unit-tests.yml   |  7 +++++--
 3 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/reusable-revised-its.yml 
b/.github/workflows/reusable-revised-its.yml
index 963695cd9f..26c045fb86 100644
--- a/.github/workflows/reusable-revised-its.yml
+++ b/.github/workflows/reusable-revised-its.yml
@@ -61,16 +61,38 @@ jobs:
         with:
           path: ~/.m2/repository
           key: maven-${{ runner.os }}-${{ inputs.build_jdk }}-${{ github.sha }}
-          fail-on-cache-miss: true
+
+      - name: Restore targets
+        id: targets-restore
+        uses: actions/cache/restore@v3
+        with:
+          path: ./**/target
+          key: maven-${{ runner.os }}-${{ inputs.build_jdk }}-targets-${{ 
github.sha }}
 
       - name: Retrieve cached docker image
+        id: docker-restore
         uses: actions/cache/restore@v3
         with:
-          key: druid-container-jdk${{ inputs.build_jdk }}.tar.gz
+          key: druid-container-jdk${{ inputs.build_jdk }}.tar.gz-${{ 
github.sha }}
           path: |
             ./druid-container-jdk${{ inputs.build_jdk }}.tar.gz
             ./integration-tests-ex/image/target/env.sh
-          fail-on-cache-miss: true
+
+      - name: Maven build
+        if: steps.maven-restore.outputs.cache-hit != 'true' || ( 
steps.docker-restore.outputs.cache-hit != 'true' && 
steps.targets-restore.outputs.cache-hit != 'true' )
+        run: |
+          ./it.sh ci
+
+      - name: Create docker image
+        if: steps.docker-restore.outputs.cache-hit != 'true'
+        env:
+          docker-restore: ${{ toJson(steps.docker-restore.outputs) }}
+        run: |
+          ./it.sh image
+          source ./integration-tests-ex/image/target/env.sh
+          docker tag $DRUID_IT_IMAGE_NAME $DRUID_IT_IMAGE_NAME-jdk${{ 
matrix.jdk }}
+          echo $DRUID_IT_IMAGE_NAME
+          docker save "$DRUID_IT_IMAGE_NAME" | gzip > druid-container-jdk${{ 
matrix.jdk }}.tar.gz
 
       - name: Load docker image
         run: |
diff --git a/.github/workflows/reusable-standard-its.yml 
b/.github/workflows/reusable-standard-its.yml
index 921b08eb1c..cb3c701270 100644
--- a/.github/workflows/reusable-standard-its.yml
+++ b/.github/workflows/reusable-standard-its.yml
@@ -74,12 +74,15 @@ jobs:
         with:
           path: ~/.m2/repository
           key: maven-${{ runner.os }}-${{ inputs.build_jdk }}-${{ github.sha }}
-          fail-on-cache-miss: true
+
+      - name: Maven build
+        if: steps.maven-restore.outputs.cache-hit != 'true'
+        run: |
+          ./it.sh ci
 
       - name: Run IT
         env:
           MYSQL_DRIVER_CLASSNAME: ${{ inputs.mysql_driver }}
-          MVN: ${{ format('{0}{1}', env.MVN, 
(steps.maven-restore.outputs.cache-hit && '' || ' -U')) }}
         run: |
           # Debug echo
           echo "Mysql driver: ${MYSQL_DRIVER_CLASSNAME}"
diff --git a/.github/workflows/reusable-unit-tests.yml 
b/.github/workflows/reusable-unit-tests.yml
index 547d8c4db9..7e48fc633b 100644
--- a/.github/workflows/reusable-unit-tests.yml
+++ b/.github/workflows/reusable-unit-tests.yml
@@ -65,7 +65,6 @@ jobs:
         with:
           path: ~/.m2/repository
           key: maven-${{ runner.os }}-${{ inputs.jdk }}-${{ github.sha }}
-          fail-on-cache-miss: true
 
       - name: setup node
         uses: actions/setup-node@v3
@@ -89,8 +88,12 @@ jobs:
       - name: setup diff-test-coverage
         run: npm install @connectis/[email protected]
 
+      - name: Maven build
+        if: steps.maven-restore.outputs.cache-hit != 'true'
+        run: |
+          ./it.sh ci
+
       - name: test & coverage
         env:
           MAVEN_PROJECTS: ${{ inputs.maven_projects }}
-          MVN: ${{ format('{0}{1}', env.MVN, 
(steps.maven-restore.outputs.cache-hit && '' || ' -U')) }}
         run: ./.github/scripts/unit_tests_script.sh


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to