name: Main build

on:
  push:
  pull_request:

jobs:
  build:
    strategy:
      matrix:
        compiler:
          - { cc: "gcc-7", cxx: "g++-7" }
          - { cc: "gcc-9", cxx: "g++-9" }

    runs-on: ubuntu-20.04
    container:
      image: amd64/ubuntu:20.04
      options: --privileged

    env:
      CC: ${{ matrix.compiler.cc }}
      CXX: ${{ matrix.compiler.cxx }}

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - run: apt update

      - name: Install deps
        run: DEBIAN_FRONTEND=noninteractive apt install -y
          build-essential
          cmake
          g++-7
          gcc-7
          git
          grep
          libfontconfig1-dev
          libfreetype-dev
          libjpeg-dev
          libmpg123-dev
          libopenmpt-dev
          libsndfile-dev
          libspeechd-dev
          qtbase5-dev
          qtbase5-dev-tools
          qtmultimedia5-dev

      - name: Configure
        run: |
          mkdir build
          cd build
          cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DSOUND=QT

      - name: Build
        run: |
          cd build
          make -j`nproc`
          make install DESTDIR=/tmp/gargoyle
