Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update github actions maven.yml to support JDK 11, 17, 21 building, also save artefacts and use caching to speed up builds where pom.xml does not change. #192

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,31 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
java: [ '11', '17', '21' ]
name: Java ${{ matrix.Java }} CI
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set JDK ${{ matrix.Java }}
uses: actions/setup-java@v4
with:
# Keep this version aligned with pom.xml!
java-version: "11"
distribution: "temurin"
java-version: ${{ matrix.java }}
distribution: "temurin" #eclipse distribution
cache: maven
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ matrix.Java }}-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-${{ matrix.Java }}
${{ runner.os }}-m2
- name: Build with Maven
run: ./mvnw -B package --file pom.xml
run: mvn --batch-mode --update-snapshots package --file pom.xml
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v4 #provide nice artifact
vorburger marked this conversation as resolved.
Show resolved Hide resolved
with:
name: Package-${{ matrix.java }}
path: staging