name: PR Build

on: pull_request

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    if: github.repository == 'spring-projects/spring-session'
    strategy:
      matrix:
        jdk: [17]
      fail-fast: false
    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK ${{ matrix.jdk }}
        uses: actions/setup-java@v4
        with:
          java-version: ${{ matrix.jdk }}
          distribution: 'temurin'
          cache: 'gradle'
      - name: Cache Gradle packages
        uses: actions/cache@v4
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
      - name: Build with Gradle
        run: ./gradlew clean build --no-daemon --stacktrace
