name: Java CI with Gradle

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 11
      uses: actions/setup-java@v1
      with:
        java-version: 11
    - name: Grant execute permission for gradlew
      run: chmod +x gradlew
    - name: Build with Gradle
      run: ./gradlew build

name: All tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  tests:
    strategy:
      matrix:
        java-version: [1.8, 10, 11, 12, 13, 14, 15]
      # in case one JDK fails, we still want to see results from others
      fail-fast: false
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/cache@v2
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-${{ matrix.java-version }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
        restore-keys: |
          ${{ runner.os }}-${{ matrix.java-version }}-gradle-
    - name: Set up JDK ${{ matrix.java-version }}
      uses: actions/setup-java@v1
      with:
        java-version: ${{ matrix.java-version }}
    - name: Grant execute permission for gradlew
      run: chmod +x gradlew
    - name: Run tests with Gradle
      run: ./gradlew test

Add CI test matrix for multiple Java versions
Add CI test matrix for multiple Java versions

Also add caching.
