Skip to content

Commit

Permalink
Stop docs job from caching incomplete Maven repositories
Browse files Browse the repository at this point in the history
`setup-java` action caches the local Maven repo once a job succeeds.
The cache key for Maven depends only on the hash of all pom.xml files.

By uploading caches from a job which only builds one module we are
forcing Maven to download missing dependencies during each build.
  • Loading branch information
MiguelWeezardo committed Oct 28, 2022
1 parent c7e0ecc commit 2887668
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ jobs:
run: |
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
$RETRY $MAVEN install -B --strict-checksums -V -T C1 -DskipTests -P ci -am -pl ':trino-docs'
- name: Clean local Maven repo
# Avoid creating a cache entry because this job doesn't download all dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: rm -rf ~/.m2/repository

test-docs:
needs: path-filters
Expand Down Expand Up @@ -121,3 +125,7 @@ jobs:
path: |
**/surefire-reports/TEST-*.xml
retention-days: ${{ env.TEST_REPORT_RETENTION_DAYS }}
- name: Clean local Maven repo
# Avoid creating a cache entry because this job doesn't download all dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: rm -rf ~/.m2/repository

0 comments on commit 2887668

Please sign in to comment.