fix maven cache in workflow
CI / Package (push) Has been cancelled
CI / Docker Build and Push (main) (push) Has been cancelled
CI / Docker Build and Push (release) (push) Has been cancelled

This commit is contained in:
anthorob committed 2026-03-18 06:23:33 -04:00
1 parent 78a359ba09
commit 99457b40fc
1 file changed
+11 -86
+11 -86
View File
@@ -10,81 +10,7 @@ on:
branches:
- "main"
env:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${{ github.workspace }}/.m2/repository -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version --no-transfer-progress -DinstallAtEnd=true -DdeployAtEnd=true"
# Docker image name; expects REGISTRY_URL like registry.example.com
CI_REGISTRY_IMAGE: "${{ secrets.REGISTRY_URL }}/${{ github.repository }}"
jobs:
compile:
name: Compile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
cache: 'maven'
- name: Cache Maven local repo and wrapper
uses: actions/cache@v5
with:
path: |
${{ github.workspace }}/.m2/repository
.mvn
key: m2-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
m2-${{ runner.os }}-
- name: Compile
run: |
chmod +x ./mvnw
./mvnw $MAVEN_CLI_OPTS compile
test:
name: Test
runs-on: ubuntu-latest
needs: compile
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
cache: 'maven'
- name: Cache Maven local repo and wrapper
uses: actions/cache@v5
with:
path: |
${{ github.workspace }}/.m2/repository
.mvn
key: m2-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
m2-${{ runner.os }}-
- name: Run tests
run: |
chmod +x ./mvnw
./mvnw $MAVEN_CLI_OPTS test
- name: Upload test reports (artifact)
if: always()
uses: actions/upload-artifact@v5
with:
name: junit-reports
path: |
**/target/*-reports/TEST-*.xml
if-no-files-found: ignore
package:
name: Package
runs-on: ubuntu-latest
@@ -100,20 +26,19 @@ jobs:
java-version: '25'
cache: 'maven'
- name: Cache Maven local repo and wrapper
uses: actions/cache@v5
with:
path: |
${{ github.workspace }}/.m2/repository
.mvn
key: m2-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
m2-${{ runner.os }}-
- name: Build package (skip tests)
- name: Build package
run: |
chmod +x ./mvnw
./mvnw $MAVEN_CLI_OPTS package -DskipTests=true
./mvnw --batch-mode --update-snapshots verify
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v5
with:
name: junit-reports
path: |
**/target/*-reports/TEST-*.xml
if-no-files-found: ignore
- name: Upload Maven artifacts
uses: actions/upload-artifact@v5