name: Build smoke test fake backend

on:
  push:
    paths:
      - 'smoke-tests/fake-backend/**'
      - '.github/workflows/build-smoke-dist-fakebackend.yaml'
    branches: 'main'
  workflow_dispatch:

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 11 for running Gradle
        uses: actions/setup-java@v1
        with:
          java-version: 11

      - name: Cache gradle dependencies
        uses: burrunan/gradle-cache-action@v1.6
        with:
          job-id: fakebackend-smoke

      - name: Login to GitHub Package Registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GHCR_TOKEN }}

      - name: Build Docker Image
        run: |
          ./gradlew jib -Djib.httpTimeout=120000 -Djib.console=plain
        working-directory: smoke-tests/fake-backend
