name: PR build Play images for smoke tests

on:
  pull_request:
    paths:
      - 'smoke-tests/images/play/**'
      - '.github/workflows/pr-smoke-test-play-images.yml'

jobs:
  build:
    uses: ./.github/workflows/reusable-smoke-test-images.yml
    with:
      project: ":smoke-tests:images:play"
      cache-read-only: true
      # Play doesn't support Java 16+ yet
      # https://github.com/playframework/playframework/pull/10819
      skip-java-17: true
      skip-java-18: true
      skip-java-19: true

  build-java-15:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up JDK for running Gradle
        uses: actions/setup-java@v3
        with:
          distribution: temurin
          java-version: 17

      - name: Set up Gradle cache
        uses: gradle/gradle-build-action@v2
        with:
          cache-read-only: true

        # Play doesn't support Java 16 (or 17) yet
        # https://github.com/playframework/playframework/pull/10819
      - name: Build Java 15 Docker image
        run: ./gradlew :smoke-tests:images:play:jibDockerBuild -PtargetJDK=15 -Djib.httpTimeout=120000 -Djib.console=plain
