fix maven cache in workflow
This commit is contained in:
1 parent
78a359ba09
commit
99457b40fc
1 file changed
+11
-86
+11
-86
@@ -10,81 +10,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- "main"
|
- "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:
|
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:
|
package:
|
||||||
name: Package
|
name: Package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -100,20 +26,19 @@ jobs:
|
|||||||
java-version: '25'
|
java-version: '25'
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
|
|
||||||
- name: Cache Maven local repo and wrapper
|
- name: Build package
|
||||||
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)
|
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./mvnw
|
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
|
- name: Upload Maven artifacts
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
|
|||||||
Reference in new issue
Block a user