name: Build and Test

on: [push, pull_request]

jobs:
  build-test:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        distro:
          - fedora
          - debian
      fail-fast: false

    steps:
      - uses: actions/checkout@v2
      - run: docker build -t packagekitqt-${{ matrix.distro }} -f tests/ci/Dockerfile-${{ matrix.distro }} .
      - run: docker run -t -v `pwd`:/build packagekitqt-${{ matrix.distro }} ./tests/ci/build-and-test.sh
        if: ${{ matrix.distro == 'fedora' }}
      - run: docker run -t -v `pwd`:/build packagekitqt-${{ matrix.distro }} ./tests/ci/build-and-test.sh
        if: ${{ matrix.distro == 'debian' }}
