-
-
Notifications
You must be signed in to change notification settings - Fork 9
41 lines (39 loc) · 1.62 KB
/
maven.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# Nota Bene: Even though the project (currently) targets Java 8 API level,
# we cannot build it under Java 8 anymore, because Error Prone (which we use)
# must be run on JDK 11 or newer (but we can and are still using
# source/target/release 8 instead 11 in the pom.xml).
java: [ '11', '17', '21' ]
name: Java ${{ matrix.Java }} CI
steps:
- uses: actions/checkout@v4
- name: Set JDK ${{ matrix.Java }}
uses: actions/setup-java@v4
with:
# Keep this version aligned with pom.xml!
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: mvn --batch-mode --update-snapshots package --file pom.xml
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v4 #provide nice artifact
with:
name: Package-${{ matrix.java }}
path: staging