Use the same maven cache for all (#11241)

Motivation:

We should use the same maven cache for all builds so we can re-use as much of the downloaded maven dependencies as possible

Modifications:

- Just use the same cache for all

Result:

Hopefully be able to re-use most of the dependencies
This commit is contained in:
Norman Maurer 2021-05-11 14:07:15 +02:00 committed by GitHub
parent 00fd4ea264
commit d984d4422c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 48 deletions

View File

@ -25,15 +25,13 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: build-${{ matrix.setup }}-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-build-
# Enable caching of Docker layers # Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.11 - uses: satackey/action-docker-layer-caching@v0.0.11

View File

@ -28,15 +28,13 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: staging-${{ matrix.setup }}-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-staging-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-staging-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-staging-
# Enable caching of Docker layers # Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.11 - uses: satackey/action-docker-layer-caching@v0.0.11
@ -77,15 +75,13 @@ jobs:
java-version: 8 java-version: 8
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: deploy-staging-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-deploy-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-deploy-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-deploy-
# Setup some env to re-use later. # Setup some env to re-use later.
- name: Prepare enviroment variables - name: Prepare enviroment variables

View File

@ -17,15 +17,13 @@ jobs:
with: with:
java-version: 8 java-version: 8
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: verify-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-pr-
- name: Verify with Maven - name: Verify with Maven
run: mvn verify -B --file pom.xml -Pci -DskipTests=true run: mvn verify -B --file pom.xml -Pci -DskipTests=true
@ -38,15 +36,13 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: build-pr-aarch64-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-pr-
- uses: uraimo/run-on-arch-action@v2.0.9 - uses: uraimo/run-on-arch-action@v2.0.9
name: Run commands name: Run commands
@ -99,15 +95,13 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: build-${{ matrix.setup }}-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-pr-
# Enable caching of Docker layers # Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.11 - uses: satackey/action-docker-layer-caching@v0.0.11

View File

@ -30,15 +30,13 @@ jobs:
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: release-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-pr-
- name: Prepare release with Maven - name: Prepare release with Maven
run: | run: |

View File

@ -37,15 +37,13 @@ jobs:
fetch-depth: 2 fetch-depth: 2
# Cache .m2/repository # Cache .m2/repository
- uses: actions/cache@v2 - name: Cache local Maven repository
env: uses: actions/cache@v2
cache-name: verify-cache-m2-repository
with: with:
path: ~/.m2/repository path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}- ${{ runner.os }}-maven-
${{ runner.os }}-pr-
# If this run was triggered by a pull request event, then checkout # If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit. # the head of the pull request instead of the merge commit.