Skip to content

Commit

Permalink
Use the same maven cache for all (#11241)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
normanmaurer committed May 11, 2021
1 parent f546718 commit 230c9d3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 48 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ jobs:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-${{ matrix.setup }}-cache-m2-repository
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-maven-
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.11
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ jobs:
- uses: actions/checkout@v2

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

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: deploy-staging-cache-m2-repository
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-deploy-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-deploy-${{ env.cache-name }}-
${{ runner.os }}-deploy-
${{ runner.os }}-maven-
# Setup some env to re-use later.
- name: Prepare enviroment variables
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ jobs:
with:
java-version: '11'
# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: verify-cache-m2-repository
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
${{ runner.os }}-maven-
- name: Verify with Maven
run: mvn verify -B --file pom.xml -Pci -DskipTests=true

Expand All @@ -38,15 +36,13 @@ jobs:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-pr-aarch64-cache-m2-repository
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
${{ runner.os }}-maven-
- uses: uraimo/run-on-arch-action@v2.0.9
name: Run commands
Expand Down Expand Up @@ -96,15 +92,13 @@ jobs:
- uses: actions/checkout@v2

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: build-${{ matrix.setup }}-cache-m2-repository
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
${{ runner.os }}-maven-
# Enable caching of Docker layers
- uses: satackey/action-docker-layer-caching@v0.0.11
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ jobs:
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}

# Cache .m2/repository
- uses: actions/cache@v2
env:
cache-name: release-cache-m2-repository
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
${{ runner.os }}-maven-
- name: Prepare release with Maven
run: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ jobs:
fetch-depth: 2

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

0 comments on commit 230c9d3

Please sign in to comment.