Skip to content

Commit a1b917f

Browse files
committed
Explicitly disable maven repo caching for selected jobs
Previously .m2/repository caching was disabled for some jobs which do not ensure complete maven repository at the end of execution by deleting .m2/repository directory. This commit changes mechanism for that to explicitly mark requeste behaviour via `cache: restore` parameter passed to` setup action.
1 parent 84e5762 commit a1b917f

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ jobs:
186186
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha &&
187187
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
188188
- uses: ./.github/actions/setup
189+
with:
190+
cache: restore
189191
- name: Maven Package
190192
run: |
191193
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
@@ -198,10 +200,6 @@ jobs:
198200
# The main Error Prone run
199201
$MAVEN ${MAVEN_TEST} -T 1C clean verify -DskipTests -P gib,errorprone-compiler \
200202
-pl '!:trino-docs,!:trino-server,!:trino-server-rpm'
201-
- name: Clean local Maven repo
202-
# Avoid creating a cache entry because this job doesn't download all dependencies
203-
if: steps.cache.outputs.cache-hit != 'true'
204-
run: rm -rf ~/.m2/repository
205203
206204
web-ui-checks:
207205
runs-on: ubuntu-latest
@@ -231,6 +229,8 @@ jobs:
231229
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha &&
232230
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
233231
- uses: ./.github/actions/setup
232+
with:
233+
cache: restore
234234
- name: Maven Install
235235
run: |
236236
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
@@ -275,10 +275,6 @@ jobs:
275275
path: |
276276
**/*.hprof
277277
retention-days: ${{ env.HEAP_DUMP_RETENTION_DAYS }}
278-
- name: Clean local Maven repo
279-
# Avoid creating a cache entry because this job doesn't download all dependencies
280-
if: steps.cache.outputs.cache-hit != 'true'
281-
run: rm -rf ~/.m2/repository
282278

283279
hive-tests:
284280
runs-on: ubuntu-latest
@@ -300,6 +296,8 @@ jobs:
300296
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha &&
301297
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
302298
- uses: ./.github/actions/setup
299+
with:
300+
cache: restore
303301
- name: Install Hive Module
304302
run: |
305303
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
@@ -426,10 +424,6 @@ jobs:
426424
check_name: ${{ github.job }} (${{ matrix.config }}) with secrets
427425
conclusion: ${{ job.status }}
428426
github_token: ${{ secrets.GITHUB_TOKEN }}
429-
- name: Clean local Maven repo
430-
# Avoid creating a cache entry because this job doesn't download all dependencies
431-
if: steps.cache.outputs.cache-hit != 'true'
432-
run: rm -rf ~/.m2/repository
433427

434428
test-other-modules:
435429
runs-on: ubuntu-latest
@@ -445,6 +439,8 @@ jobs:
445439
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha &&
446440
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
447441
- uses: ./.github/actions/setup
442+
with:
443+
cache: restore
448444
- name: Maven Install
449445
run: |
450446
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
@@ -516,10 +512,6 @@ jobs:
516512
path: |
517513
**/*.hprof
518514
retention-days: ${{ env.HEAP_DUMP_RETENTION_DAYS }}
519-
- name: Clean local Maven repo
520-
# Avoid creating a cache entry because this job doesn't download all dependencies
521-
if: steps.cache.outputs.cache-hit != 'true'
522-
run: rm -rf ~/.m2/repository
523515

524516
build-test-matrix:
525517
runs-on: ubuntu-latest
@@ -534,6 +526,8 @@ jobs:
534526
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha &&
535527
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
536528
- uses: ./.github/actions/setup
529+
with:
530+
cache: restore
537531
- name: Update PR check
538532
uses: ./.github/actions/update-check
539533
if: >-
@@ -603,10 +597,6 @@ jobs:
603597
./.github/bin/build-matrix-from-impacted.py -v -i gib-impacted.log -m .github/test-matrix.yaml -o matrix.json
604598
echo "Matrix: $(jq '.' matrix.json)"
605599
echo "matrix=$(jq -c '.' matrix.json)" >> $GITHUB_OUTPUT
606-
- name: Clean local Maven repo
607-
# Avoid creating a cache entry because this job doesn't download all dependencies
608-
if: steps.cache.outputs.cache-hit != 'true'
609-
run: rm -rf ~/.m2/repository
610600
611601
test:
612602
runs-on: ubuntu-latest
@@ -628,6 +618,7 @@ jobs:
628618
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
629619
- uses: ./.github/actions/setup
630620
with:
621+
cache: restore
631622
java-version: ${{ matrix.jdk != '' && matrix.jdk || '17' }}
632623
- name: Cleanup node
633624
# This is required as a virtual environment update 20210219.1 left too little space for MemSQL to work
@@ -816,10 +807,6 @@ jobs:
816807
check_name: ${{ github.job }} with secrets
817808
conclusion: ${{ job.status }}
818809
github_token: ${{ secrets.GITHUB_TOKEN }}
819-
- name: Clean local Maven repo
820-
# Avoid creating a cache entry because this job doesn't download all dependencies
821-
if: steps.cache.outputs.cache-hit != 'true'
822-
run: rm -rf ~/.m2/repository
823810

824811
build-pt:
825812
runs-on: ubuntu-latest
@@ -835,6 +822,8 @@ jobs:
835822
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.args.named.sha &&
836823
format('refs/pull/{0}/head', github.event.client_payload.pull_request.number) || '' }}
837824
- uses: ./.github/actions/setup
825+
with:
826+
cache: restore
838827
- uses: dorny/paths-filter@v2
839828
id: filter
840829
with:
@@ -1053,10 +1042,6 @@ jobs:
10531042
run: |
10541043
echo "Matrix: $(jq '.' matrix.json)"
10551044
echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT
1056-
- name: Clean local Maven repo
1057-
# Avoid creating a cache entry because this job doesn't download all dependencies
1058-
if: steps.cache.outputs.cache-hit != 'true'
1059-
run: rm -rf ~/.m2/repository
10601045
10611046
pt:
10621047
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)