# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Latest IJ

on:
  schedule:
  - cron: "0 0 * * *"

jobs:

  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          java-version: 17
          distribution: 'temurin'
          cache: 'gradle'
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Build with Gradle
        run: |
          LATEST_EAP_SNAPSHOT=$(./gradlew printProductsReleases | grep 'IC-' | head -n 1 | cut -d'-' -f2)
          ./gradlew build --continue -PplatformVersion=$LATEST_EAP_SNAPSHOT
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: test-reports
          path: |
            build/test-results/**/*.xml
            build/jacoco/