name: Java CI with Maven

on:
  push:
  pull_request:

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        java: [ 8, 11, 17, 21, 25 ]

    steps:
    - uses: actions/checkout@v6
    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v5
      with:
        java-version: ${{ matrix.java }}
        distribution: 'temurin'
    - name: Build with Maven
      run: mvn clean install -Dgpg.skip -Dmaven.javadoc.skip=true


  coverage:
    runs-on: ubuntu-latest
    needs: build
    steps:
    - uses: actions/checkout@v6
    - name: Set up Java
      uses: actions/setup-java@v5
      with:
        distribution: temurin
        java-version: 8
    - name: Build with Maven
      run: mvn clean install -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.test.failure.ignore=true
    - name: Upload coverage reports to Codecov
      uses: codecov/codecov-action@v5
      with:
        token: ${{ secrets.CODECOV_TOKEN }}

