-
Notifications
You must be signed in to change notification settings - Fork 76
75 lines (74 loc) · 2.49 KB
/
ci.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: CI
on:
push:
paths:
- '**.java'
- '**.xml'
- '.github/workflows/*.yml'
pull_request:
jobs:
supported-jdk:
name: ${{ matrix.title }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- title: "Supported JDK 8"
experimental: false
cache-id: "jdk8"
java: 8
dist: temurin
flags: ""
- title: "Supported JDK 11"
experimental: false
cache-id: "jdk11"
java: 11
dist: temurin
flags: ""
- title: "Supported JDK 17"
experimental: false
cache-id: "jdk17"
java: 17
dist: temurin
flags: ""
- title: "Supported JDK 21"
experimental: false
cache-id: "jdk21"
java: 21
dist: zulu
flags: ""
runs-on: ubuntu-latest
steps:
- name: 'Checkout from Git'
# Can't refer to matrix in job if conditional, so we have to repeat it every step: https://github.com/actions/runner/issues/1985
if: ${{ !(matrix.experimental && github.event_name == 'pull_request') }}
uses: actions/checkout@v4
- name: 'Cache Maven repo'
if: ${{ !(matrix.experimental && github.event_name == 'pull_request') }}
uses: actions/cache@v3
with:
path: |
~/.m2/repository
target/spotless-node-modules-prettier-format
key: ${{ runner.os }}-mvn-${{ matrix.cache-id }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-${{ matrix.cache-id }}
- name: 'Set up JDK ${{ matrix.java }}'
if: ${{ !(matrix.experimental && github.event_name == 'pull_request') }}
uses: actions/setup-java@v3
with:
distribution: ${{ matrix.dist }}
java-version: ${{ matrix.java }}
- name: 'Set up node' # Needed for formatting with prettier
if: ${{ !(matrix.experimental && github.event_name == 'pull_request') }}
uses: actions/setup-node@v3
with:
node-version: 12
- name: 'Display JDK version'
if: ${{ !(matrix.experimental && github.event_name == 'pull_request') }}
run: java -version
- name: 'Run Maven'
if: ${{ !(matrix.experimental && github.event_name == 'pull_request') }}
# Don't clean, or whatever was cached in target/spotless-node-modules-prettier-format is lost
run: mvn verify ${{ matrix.flags }}