image: fedora:rawhide

variables:
  DEPENDENCIES:
    gtk-doc
    meson
    gettext-devel
    gcc
    redhat-rpm-config
    gcc-c++
    glibc-devel
    systemd
    sqlite-devel
    gobject-introspection-devel
    libgudev-devel
    libimobiledevice-devel
    glib2-devel
    libplist-devel
    umockdev
    dbus-x11
    python3-gobject
    python3-dbus
    python3-pip
    python3-packaging
    git
  # Make this explicit for check-abi, as it still builds the old version using "make"
  AUTOTOOLS_DEPENDENCIES:
    libtool
    autoconf
    automake
    make
  LAST_ABI_BREAK: "e294444496e8bbcd91a3605874f59562e14c34ec"

build_stable:
  before_script:
    - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES
    - git clone https://github.com/martinpitt/python-dbusmock.git /tmp/python-dbusmock
    - echo '## [0.23.2] - UNRELEASED' | cat - /tmp/python-dbusmock/NEWS > /tmp/python-dbusmock/NEWS.tmp
    - mv /tmp/python-dbusmock/NEWS.tmp /tmp/python-dbusmock/NEWS
    - sed -i 's,0.23.1,0.23.2,' /tmp/python-dbusmock/dbusmock/__init__.py
    - pip install /tmp/python-dbusmock
  script:
    - meson _build -Dintrospection=enabled -Dman=true -Dgtk-doc=true -Didevice=enabled
    - meson test -C _build --print-errorlogs --no-stdsplit
    - .ci/fail_skipped_tests.py _build/meson-logs/testlog.junit.xml
  artifacts:
    when: on_success
    name: "upower-${CI_COMMIT_REF_NAME}"
    paths:
      - "${CI_PROJECT_DIR}/_build/upower-*.tar.xz"
  artifacts:
    when: always
    paths:
      - "${CI_PROJECT_DIR}/_build/meson-logs/"

check_abi:
  before_script:
    - dnf update -y --nogpgcheck && dnf install -y --nogpgcheck $DEPENDENCIES $AUTOTOOLS_DEPENDENCIES
  script:
    - curl https://gitlab.freedesktop.org/hadess/check-abi/-/raw/main/contrib/check-abi-fedora.sh | bash
    - check-abi --suppr .ci/upower.suppr --old-parameters="--with-idevice --disable-tests --disable-static --disable-gtk-doc" --new-parameters="-Dman=false -Dgtk-doc=false -Didevice=enabled"  ${LAST_ABI_BREAK} $(git rev-parse HEAD)
