name: Test Docker build for PR
on:
  pull_request:
    paths:
      - 'requirements.txt'
  workflow_dispatch: ~

jobs:
  build:
    strategy:
      matrix:
        platform: [ 'linux/amd64', 'linux/arm64' ]
        EXP_DEPS: [ 0, 1 ]
    name: ${{ matrix.platform }} - EXP_DEPS=${{ matrix.EXP_DEPS }}
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v2
      - name: Test Docker build
        uses: docker/build-push-action@v3
        with:
          push: false
          context: .
          build-args: EXP_DEPS=${{ matrix.EXP_DEPS }}
          platforms: ${{ matrix.platform }}
          cache-from: type=gha,scope=docker-release
