on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        debian_version: [buster, bullseye]
        docker_arch: [amd64, arm32v7, arm64v8]
        build_type: ["non-rpi", "rpi"]
        exclude:
          - docker_arch: amd64
            build_type: rpi
    steps:
    - name: Checkout
      uses: actions/checkout@v3
      with:
        submodules: recursive
    - name: Set up QEMU
      uses: docker/setup-qemu-action@v2
    - name: Build Dockerfile
      run: docker build --build-arg DOCKER_ARCH --build-arg DEBIAN_VERSION --build-arg BUILD_TYPE .
      env:
        DEBIAN_VERSION: ${{ matrix.debian_version }}
        DOCKER_ARCH: ${{ matrix.docker_arch }}/
        BUILD_TYPE: ${{ matrix.build_type }}
