name: Java CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.experimental }}
    strategy:
      matrix:
        java: [ 11, 15 ]
        experimental: [false]
        include:
          - java: 16-ea
            experimental: true

    steps:
    - uses: actions/checkout@v2.3.4
    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v1.4.3
      with:
        java-version: ${{ matrix.java }}
    - name: Cache Maven packages
      uses: actions/cache@v2.1.4
      with:
        path: ~/.m2
        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
        restore-keys: ${{ runner.os }}-m2
    - name: Build with Maven
      run: mvn -B clean package --file pom.xml

name: Java CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    continue-on-error: ${{ matrix.experimental }}
    strategy:
      matrix:
        java: [ 11, 16 ]
        experimental: [false]
        include:
          - java: 17-ea
            experimental: true

    steps:
    - uses: actions/checkout@v2.3.4
    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v2.0.0
      with:
        distribution: 'adopt'
        java-version: ${{ matrix.java }}
    - name: Cache Maven packages
      uses: actions/cache@v2.1.4
      with:
        path: ~/.m2
        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
        restore-keys: ${{ runner.os }}-m2
    - name: Build with Maven
      run: mvn -B clean package --file pom.xml

Build with latest Java 16 & 17 EA and update to actions/setup-java@v2
Build with latest Java 16 & 17 EA and update to actions/setup-java@v2
