---
name: Java CI

on:
  push:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java: [8, 11, 17, 18] # todo: update to latest Gradle version for Java 21 support
      fail-fast: false
      max-parallel: 4
    name: JDK ${{ matrix.java }}

    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK
        uses: actions/setup-java@v3
        with:
          java-version: ${{ matrix.java }}
          distribution: temurin
          cache: 'gradle'

      - name: Grant execute permission for gradlew
        run: chmod +x gradlew

      - name: Build with Gradle
        run: ./gradlew build --warning-mode all

      - name: Run Tests
        run: ./gradlew check

      - name: Maven Install
        run: ./gradlew clean publishToMavenLocal

...
