Updates CI pipeline for Java 21 #1636
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: "" | |
- title: "Experimental JDK EA (simplified)" | |
experimental: false | |
cache-id: "jdk-ea-simple" | |
java: "22-ea" | |
dist: zulu | |
flags: "-Dexperimental -DdisableStaticAnalysis" | |
- title: "Experimental JDK EA (full)" | |
experimental: true | |
cache-id: "jdk-ea-full" | |
java: "22-ea" | |
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@v3 | |
- 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 }} |