image: ubuntu:22.04

variables:
  UBUNTU_DEPS:
    appstream-util
    desktop-file-utils
    build-essential
    meson
    flex
    yelp-tools
    libexiv2-dev
    libgsf-1-dev
    libgtk2.0-dev
    libpoppler-glib-dev
    libsmbclient-dev
    libtag1-dev
    libunique-dev
    libgtest-dev

before_script:
  - export DEBIAN_FRONTEND=noninteractive
  - apt-get update -qq
  - apt-get install -y $UBUNTU_DEPS

build-and-test-job:
  script:
    - mkdir _builddir
    - meson setup _builddir
    - echo "Compiling the code..."
    - meson compile -C _builddir
    - echo "Compile complete. Starting Unit test phase..."
    - exit_code=0
    - meson test -C _builddir || exit_code=$?; if [ "$exit_code" != "0" ]; then echo "Unit tests failed."; cat _builddir/meson-logs/testlog.txt; exit 1; fi;
    - echo "Unit tests passed."
