Merge pull request 'ci(github-actions): use multiple maven caches for increased hit rate, use forgejo checkout action' (#47) from cache into main
All checks were successful
Build / build (push) Successful in 1m59s
All checks were successful
Build / build (push) Successful in 1m59s
Reviewed-on: phoenix/quarkus-commons#47
This commit is contained in:
commit
2563b3699c
2 changed files with 46 additions and 4 deletions
25
.github/workflows/build.yaml
vendored
25
.github/workflows/build.yaml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
|
@ -31,7 +31,28 @@ jobs:
|
|||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Generate cache keys
|
||||
id: cache-key
|
||||
run: |
|
||||
CURRENT_BRANCH="${{ github.head_ref || github.ref_name }}"
|
||||
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
|
||||
CURRENT_DAY=$(/bin/date -u "+%d")
|
||||
ROOT_CACHE_KEY="m2-cache-quarkus-commons"
|
||||
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
|
||||
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
|
||||
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Maven Repository
|
||||
id: cache-maven
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
# The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
|
||||
key: ${{ steps.cache-key.outputs.m2-cache-key }}
|
||||
restore-keys: |
|
||||
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}
|
||||
${{ steps.cache-key.outputs.m2-monthly-cache-key }}
|
||||
|
||||
- name: Configure Maven CI/CD settings
|
||||
uses: https://github.com/s4u/maven-settings-action@v3.1.0
|
||||
|
|
25
.github/workflows/release.yaml
vendored
25
.github/workflows/release.yaml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Retrieve project metadata
|
||||
uses: https://github.com/radcortez/project-metadata-action@master
|
||||
|
@ -64,7 +64,28 @@ jobs:
|
|||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Generate cache keys
|
||||
id: cache-key
|
||||
run: |
|
||||
CURRENT_BRANCH="${{ github.ref_name }}"
|
||||
CURRENT_MONTH=$(/bin/date -u "+%Y-%m")
|
||||
CURRENT_DAY=$(/bin/date -u "+%d")
|
||||
ROOT_CACHE_KEY="m2-cache-quarkus-commons"
|
||||
echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITHUB_OUTPUT
|
||||
echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
|
||||
echo "m2-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}-${CURRENT_DAY}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Maven Repository
|
||||
id: cache-maven
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
# The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch.
|
||||
key: ${{ steps.cache-key.outputs.m2-cache-key }}
|
||||
restore-keys: |
|
||||
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}
|
||||
${{ steps.cache-key.outputs.m2-monthly-cache-key }}
|
||||
|
||||
- name: Make maven wrapper executable
|
||||
run: chmod +x mvnw
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue