[libgweather/pgriffis/libsoup-ci: 2/4] ci: Build against both libsoup2 and libsoup3




commit ca05e7550903bd835b751faff5fd7fca6be76440
Author: Patrick Griffis <pgriffis igalia com>
Date:   Tue Sep 21 10:59:03 2021 -0500

    ci: Build against both libsoup2 and libsoup3

 .ci/check-abi  | 113 ---------------------------------------------------------
 .gitlab-ci.yml |  81 ++++++++++++++++++++++++++++++++++++-----
 meson.build    |  10 +++++
 3 files changed, 82 insertions(+), 122 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e6387602..248bdba5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,17 +1,80 @@
 variables:
-    LAST_ABI_BREAK: f1f0bdd9ab47ff8ddba17e2125802c928226da64
+  LAST_ABI_BREAK: f1f0bdd9ab47ff8ddba17e2125802c928226da64
+  COMMON_DEPS:
+    glibc-langpack-fr
+    redhat-rpm-config
+    meson
+    libxml2-devel
+    vala
+    gettext
+    itstool
+    gtk3-devel
+    geocode-glib-devel
+    gobject-introspection-devel
+    libsoup-devel
+    libabigail
+    git
+    python3-gobject
+    pylint
+  SOUP3_DEPS: # Includes deps for geocode-glib
+    gcc-c++
+    gtk-doc
+    json-glib-devel
+    gnutls-devel
+    libnghttp2-devel
+    sqlite-devel
+    libpsl-devel
 
-build-fedora:
+.build:
   image: fedora:latest
+  script:
+    - meson _build -Dsoup2=${SOUP2_ENABLED}
+    - ninja -C _build install
+    - ninja -C _build test
+    - curl https://gitlab.freedesktop.org/hadess/check-abi/-/raw/main/contrib/check-abi-fedora.sh | bash
+    - check-abi --new-parameters="-Dsoup2=${SOUP2_ENABLED}" ${LAST_ABI_BREAK} $(git rev-parse HEAD)
+  artifacts:
+    name: "libgweather-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
+    when: on_failure
+    paths:
+      - "**/meson-logs/*"
+
+build-fedora-soup2:
+  extends: .build
+  variables:
+    SOUP2_ENABLED: 'true'
   before_script:
     # Undo delangification present in the Fedora Docker images
     - rm -f /etc/rpm/macros.image-language-conf
     - dnf reinstall -y glib2 glibc || dnf update -y glib2 glibc
-    # Add French locale support for tests
-    - dnf install -y glibc-langpack-fr
-    - dnf install -y redhat-rpm-config meson libxml2-devel vala gettext itstool gtk3-devel 
geocode-glib-devel gobject-introspection-devel libsoup-devel libabigail git python3-gobject pylint
-  script:
-    - meson _build
+    - dnf install -y $COMMON_DEPS
+
+build-fedora-soup3:
+  extends: .build
+  variables:
+    SOUP2_ENABLED: 'false'
+  before_script:
+    # Undo delangification present in the Fedora Docker images
+    - rm -f /etc/rpm/macros.image-language-conf
+    - dnf reinstall -y glib2 glibc || dnf update -y glib2 glibc
+    - dnf install -y $COMMON_DEPS $SOUP3_DEPS
+    # Tasks specific to soup3
+    - git clone https://gitlab.gnome.org/GNOME/glib.git && pushd glib
+    - git checkout 2.70.0
+    - meson _build --prefix=/usr
     - ninja -C _build install
-    - ninja -C _build test
-    - ./.ci/check-abi ${LAST_ABI_BREAK} $(git rev-parse HEAD)
+    - popd
+    - git clone https://gitlab.gnome.org/GNOME/glib-networking.git && pushd glib-networking
+    - git checkout 2.70.0
+    - meson _build --prefix=/usr
+    - ninja -C _build install
+    - popd
+    - git clone --depth=1 https://gitlab.gnome.org/GNOME/libsoup.git && pushd libsoup
+    - meson _build --prefix=/usr -Dtls_check=false
+    - ninja -C _build install
+    - popd
+    - git clone https://gitlab.gnome.org/GNOME/geocode-glib.git && pushd geocode-glib
+    - meson _build --prefix=/usr -Dsoup2=false
+    - ninja -C _build install
+    - popd
+
diff --git a/meson.build b/meson.build
index f77025fe..95e69a1d 100644
--- a/meson.build
+++ b/meson.build
@@ -48,9 +48,11 @@ libxml_req_version = '>= 2.6.0'
 if get_option('soup2')
   libsoup_name = 'libsoup-2.4'
   libsoup_req_version = '>= 2.44.0'
+  libsoup_api_version = '2.4'
 else
   libsoup_name = 'libsoup-3.0'
   libsoup_req_version = '>= 2.99.2'
+  libsoup_api_version = '3.0'
 endif
 
 c_compiler = meson.get_compiler('c')
@@ -62,6 +64,14 @@ geocode_glib_dep = dependency('geocode-glib-1.0')
 math_dep = c_compiler.find_library('m', required : false)
 deps_libgweather = [math_dep, gtk_dep, glib_dep, libsoup_dep, libxml_dep, geocode_glib_dep]
 
+geocode_soup_version = geocode_glib_dep.get_pkgconfig_variable('soupapiversion')
+if geocode_soup_version == ''
+  geocode_soup_version = '2.4' # Pre libsoup3 support
+endif
+if geocode_soup_version != libsoup_api_version
+  error('geocode-glib was built against a different API of libsoup. @0@ instead of 
@1@.'.format(geocode_soup_version, libsoup_api_version))
+endif
+
 pylint = find_program('pylint-3', 'pylint3', 'pylint', required: false)
 pylint_flags = ['-d', 'C0111', '-d', 'W0511', '-d', 'F0401', '-d', 'C0326' ]
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]