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




commit dc53ffe3a5205455c68e3acf32da6b8c01254d51
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 | 49 +++++++++++++++++++++++++++++++++++++++++--------
 meson.build    | 10 ++++++++++
 2 files changed, 51 insertions(+), 8 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7870dd2b..335a6af8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,17 +24,50 @@ variables:
     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 56d37733..2ed4c090 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]