image: fedora:rawhide

variables:
  DEPENDENCIES: glib2-devel
                libgudev-devel
                gtk-doc
                gcc
                gcc-c++
                glibc-devel
                meson
                git
                libxslt
                python3-gobject
                python3-dbusmock
                umockdev

build:
  before_script:
    - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES
  script:
    - meson -Dgtk_doc=true _build
    - ninja -v -C _build
    - ninja -v -C _build switcheroo-control-doc
    - ninja -v -C _build install
    - ninja -v -C _build uninstall
    - ninja -v -C _build dist
    - meson test -C _build

dist-job:
  stage: build
  only:
    - tags
  before_script:
    - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES
  script:
    - meson --buildtype release -Dgtk_doc=true _build
    - cd _build
    - ninja dist
    - ninja switcheroo-control-doc
    - tar -c -J -f "switcheroo-control-docs-$CI_COMMIT_TAG.tar.xz" -C docs/ html
  artifacts:
    paths:
      - "${CI_PROJECT_DIR}/_build/switcheroo-control-docs-$CI_COMMIT_TAG.tar.xz"
      - "${CI_PROJECT_DIR}/_build/meson-dist/switcheroo-control-*.tar.xz"
