name: linux

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set up build variables
      run: bash ./.github/scripts/setup_build_variables.sh

    - name: Set up linux build variables
      run: bash ./.github/scripts/linux/setup_linux_build_variables.sh

    - name: Install Qt
      uses: jurplel/install-qt-action@v2
      with:
        version: '5.15.2'
        host: 'linux'
        install-deps: 'true'

    - name: Install dependencies
      run: sudo apt-get install extra-cmake-modules xvfb

    - name: Set up GoogleTest
      run: bash ./.github/scripts/setup_googleTest.sh

    - name: Set up kColorPicker
      run: bash ./.github/scripts/setup_kColorPicker.sh

    - name: Build
      run: bash ./.github/scripts/build_kImageAnnotator.sh

    - name: Test
      working-directory: ${{github.workspace}}/build/tests
      run: xvfb-run --auto-servernum --server-num=1 --server-args="-screen 0 1024x768x24" ctest --extra-verbose
      
