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




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

    ci: Build against both libsoup2 and libsoup3

 .gitlab-ci.yml | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 meson.build    | 10 ++++++++
 2 files changed, 74 insertions(+), 9 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e6387602..aea361e2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,17 +1,72 @@
 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
+    gcc-c++
+  SOUP3_DEPS:
+    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
+    - ./.ci/check-abi ${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.69.3
+    - 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 --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 --branch=pgriffis/soupapiversion && pushd 
geocode-glib
+    - meson _build --prefix=/usr -Dsoup2=false
+    - ninja -C _build install
+    - popd
+
diff --git a/meson.build b/meson.build
index e3be9bd2..ea4d472b 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')
@@ -63,6 +65,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, gmodule_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]