name: PR build fake backend images for smoke tests

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

jobs:
  buildLinux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

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

      - name: Build Docker image
        uses: gradle/gradle-build-action@v2
        with:
          arguments: :smoke-tests:images:fake-backend:jibDockerBuild -Djib.httpTimeout=120000 -Djib.console=plain
          cache-read-only: true

  buildWindows:
    runs-on: windows-2019
    defaults:
      run:
        shell: bash
    steps:
      - name: Support long paths
        run: git config --system core.longpaths true

      - uses: actions/checkout@v3

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

      - name: Build Docker image
        uses: gradle/gradle-build-action@v2
        with:
          arguments: :smoke-tests:images:fake-backend:windowsBackendImageBuild
          cache-read-only: true
