[totem/bilelmoussaoui/meson-tests] build: Add tests to validate schema/desktop/appdata files



commit 000d21dcfb01b05825b53f45e91ee062cf92e743
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed Sep 25 19:53:05 2019 +0200

    build: Add tests to validate schema/desktop/appdata files
    
    The flatpak CI template already runs ninja tests for us.
    Let's use that to ensure the appdata/desktop/schema files are always valid

 .gitlab-ci.yml           |  2 +-
 data/appdata/meson.build | 12 +++++++++++-
 data/meson.build         | 23 ++++++++++++++++++++++-
 3 files changed, 34 insertions(+), 3 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 785b24c51..fa970f96d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,7 +8,7 @@ build-fedora:
   image: fedora:latest
   stage: test
   before_script:
-    - dnf install -y redhat-rpm-config meson git cairo-devel clutter-devel clutter-gst3-devel 
clutter-gtk-devel gcc-c++ gettext gnome-desktop3-devel grilo-devel gsettings-desktop-schemas-devel 
gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-plugins-good gtk3-devel gtk-doc itstool 
libappstream-glib liberation-sans-fonts libpeas-devel pygobject3-devel pylint python3-devel 
totem-pl-parser-devel flatpak-builder xorg-x11-server-Xvfb
+    - dnf install -y redhat-rpm-config meson git cairo-devel desktop-file-utils clutter-devel 
libappstream-glib clutter-gst3-devel clutter-gtk-devel gcc-c++ gettext gnome-desktop3-devel grilo-devel 
gsettings-desktop-schemas-devel gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-plugins-good 
gtk3-devel gtk-doc itstool libappstream-glib liberation-sans-fonts libpeas-devel pygobject3-devel pylint 
python3-devel totem-pl-parser-devel flatpak-builder xorg-x11-server-Xvfb
   script:
     - meson _build
     - G_MESSAGES_DEBUG=all xvfb-run -a -s "-screen 0 1024x768x24" ninja -C _build test
diff --git a/data/appdata/meson.build b/data/appdata/meson.build
index 7f82d374d..a66f1921b 100644
--- a/data/appdata/meson.build
+++ b/data/appdata/meson.build
@@ -1,8 +1,18 @@
 appdata = 'org.gnome.Totem.appdata.xml'
 
-i18n.merge_file ('appdata',
+appdata_file = i18n.merge_file ('appdata',
                  input: appdata + '.in',
                  output: appdata,
                  install: true,
                  install_dir: join_paths(totem_datadir, 'metainfo'),
                  po_dir: po_dir,)
+# Validate Appdata
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+  test(
+    'validate-appdata', appstream_util,
+    args: [
+      'validate', '--nonet', appdata_file.full_path()
+    ]
+  )
+endif
diff --git a/data/meson.build b/data/meson.build
index 6cb83f4b6..ab44aba88 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -68,7 +68,7 @@ desktop_in = configure_file(
   configuration: desktop_conf
 )
 
-i18n.merge_file (
+desktop_file = i18n.merge_file (
   desktop,
   type: 'desktop',
   input: desktop_in,
@@ -77,6 +77,17 @@ i18n.merge_file (
   install: true,
   install_dir: join_paths(totem_datadir, 'applications')
 )
+# Validate Desktop file
+desktop_file_validate = find_program('desktop-file-validate', required: false)
+if desktop_file_validate.found()
+  test(
+    'validate-desktop',
+    desktop_file_validate,
+    args: [
+      desktop_file.full_path()
+    ]
+  )
+endif
 
 service_conf = configuration_data()
 service_conf.set('bindir', totem_bindir)
@@ -158,6 +169,16 @@ configure_file(
   install_dir: totem_schemadir,
   configuration: schema_conf
 )
+# Validata GSchema
+glib_compile_schemas = find_program('glib-compile-schemas', required: false)
+if glib_compile_schemas.found()
+  test(
+    'validate-gschema', glib_compile_schemas,
+    args: [
+      '--strict', '--dry-run', meson.current_source_dir()
+    ]
+  )
+endif
 
 install_data(
   'totem.convert',


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