mirror of https://github.com/apache/druid.git
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
This commit is contained in:
parent
752964390e
commit
477bc424d9
|
@ -61,16 +61,38 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
key: maven-${{ runner.os }}-${{ inputs.build_jdk }}-${{ github.sha }}
|
key: maven-${{ runner.os }}-${{ inputs.build_jdk }}-${{ github.sha }}
|
||||||
fail-on-cache-miss: true
|
|
||||||
|
|
||||||
- name: Retrieve cached docker image
|
- name: Restore targets
|
||||||
|
id: targets-restore
|
||||||
uses: actions/cache/restore@v3
|
uses: actions/cache/restore@v3
|
||||||
with:
|
with:
|
||||||
key: druid-container-jdk${{ inputs.build_jdk }}.tar.gz
|
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-${{ github.sha }}
|
||||||
path: |
|
path: |
|
||||||
./druid-container-jdk${{ inputs.build_jdk }}.tar.gz
|
./druid-container-jdk${{ inputs.build_jdk }}.tar.gz
|
||||||
./integration-tests-ex/image/target/env.sh
|
./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
|
- name: Load docker image
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -74,12 +74,15 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
key: maven-${{ runner.os }}-${{ inputs.build_jdk }}-${{ github.sha }}
|
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
|
- name: Run IT
|
||||||
env:
|
env:
|
||||||
MYSQL_DRIVER_CLASSNAME: ${{ inputs.mysql_driver }}
|
MYSQL_DRIVER_CLASSNAME: ${{ inputs.mysql_driver }}
|
||||||
MVN: ${{ format('{0}{1}', env.MVN, (steps.maven-restore.outputs.cache-hit && '' || ' -U')) }}
|
|
||||||
run: |
|
run: |
|
||||||
# Debug echo
|
# Debug echo
|
||||||
echo "Mysql driver: ${MYSQL_DRIVER_CLASSNAME}"
|
echo "Mysql driver: ${MYSQL_DRIVER_CLASSNAME}"
|
||||||
|
|
|
@ -65,7 +65,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
key: maven-${{ runner.os }}-${{ inputs.jdk }}-${{ github.sha }}
|
key: maven-${{ runner.os }}-${{ inputs.jdk }}-${{ github.sha }}
|
||||||
fail-on-cache-miss: true
|
|
||||||
|
|
||||||
- name: setup node
|
- name: setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
@ -89,8 +88,12 @@ jobs:
|
||||||
- name: setup diff-test-coverage
|
- name: setup diff-test-coverage
|
||||||
run: npm install @connectis/diff-test-coverage@1.5.3
|
run: npm install @connectis/diff-test-coverage@1.5.3
|
||||||
|
|
||||||
|
- name: Maven build
|
||||||
|
if: steps.maven-restore.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
./it.sh ci
|
||||||
|
|
||||||
- name: test & coverage
|
- name: test & coverage
|
||||||
env:
|
env:
|
||||||
MAVEN_PROJECTS: ${{ inputs.maven_projects }}
|
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
|
run: ./.github/scripts/unit_tests_script.sh
|
||||||
|
|
Loading…
Reference in New Issue