[seahorse/wip/nielsdg/use-flatpak-nightly-template] ci: Use GNOME's flatpak CI template



commit 99aa62baf5afdbf6c7435a3d1f1f0c8c5888124e
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Oct 4 08:39:26 2019 +0200

    ci: Use GNOME's flatpak CI template
    
    GNOME has started issuing templates for Flatpaks in the CI. Use these to
    simplify our own CI script and to benefit if any features pops up in
    there.
    
    With this change, we also add a "profile" option, which allows us to
    differentiate between development builds and actual releases.

 .gitlab-ci.yml       | 52 +++++++++++++++++++++++++++++-----------------------
 common/config.vapi   |  2 ++
 data/meson.build     |  4 ++--
 meson.build          |  8 ++++++++
 meson_options.txt    |  1 +
 src/application.vala |  2 +-
 6 files changed, 43 insertions(+), 26 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 55618355..ce113d9c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,29 +1,35 @@
+include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
+
 stages:
-  - build-flatpak
+- test
+- deploy
+
+variables:
+  BUNDLE: 'seahorse.flatpak'
 
-# We always use flatpak-builder to check if everything still works.
-flatpak:master:
+flatpak:
   image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
-  stage: build-flatpak
   variables:
     MANIFEST_PATH: 'build-aux/org.gnome.Seahorse.json'
-    BUNDLE: 'seahorse-dev.flatpak'
+    MESON_ARGS: "-Dprofile=development"
+    FLATPAK_MODULE: "seahorse"
+    RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
+    APP_ID: "org.gnome.seahorse.ApplicationDevel"
+  extends: .flatpak
+
+review:
+  stage: deploy
+  dependencies:
+    - flatpak
   script:
-    - flatpak-builder --stop-at=seahorse app ${MANIFEST_PATH}
-    # Make sure to keep this in sync with the Flatpak manifest, all arguments
-    # are passed except the config-args because we build it ourselves
-    - flatpak build app meson --prefix=/app _build
-    - flatpak build app ninja -C _build install
-    - flatpak-builder --finish-only --repo=repo app ${MANIFEST_PATH}
-    # Make a Flatpak Seahorse bundle for people to test
-    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=https://sdk.gnome.org/gnome-nightly.flatpakrepo 
org.gnome.seahorse.Application
-    # - xvfb-run -a -s "-screen 0 1024x768x24" flatpak build app ninja -C _build test
-  artifacts:
-    paths:
-      - ${BUNDLE}
-      - _build/meson-logs/meson-log.txt
-      - _build/meson-logs/testlog.txt
-    expire_in: 2 days
-  cache:
-    paths:
-      - .flatpak-builder/cache
+    - echo "Generating flatpak deployment"
+  extends: '.review'
+
+stop_review:
+  stage: deploy
+  script:
+    - echo "Stopping flatpak deployment"
+  extends: '.stop_review'
+
+nightly:
+  extends: '.publish_nightly'
diff --git a/common/config.vapi b/common/config.vapi
index 20a6b5a9..19d0b7cf 100644
--- a/common/config.vapi
+++ b/common/config.vapi
@@ -1,6 +1,8 @@
 [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
 namespace Config
 {
+    public const string APPLICATION_ID;
+
        public const string PKGDATADIR;
 
        public const string EXECDIR;
diff --git a/data/meson.build b/data/meson.build
index 746ce5ae..7dafa8d2 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -19,7 +19,7 @@ resources_src = gnome.compile_resources('seahorse-resources',
 # The appdata file
 i18n.merge_file(
   input: 'org.gnome.seahorse.Application.appdata.xml.in',
-  output: 'org.gnome.seahorse.Application.appdata.xml',
+  output: '@0  appdata xml'.format(application_id),
   type: 'xml',
   po_dir: po_dir,
   install: true,
@@ -36,7 +36,7 @@ configured_desktop_file = configure_file(
 )
 i18n.merge_file(
   input: configured_desktop_file,
-  output: 'org.gnome.seahorse.Application.desktop',
+  output: '@0@.desktop'.format(application_id),
   type: 'desktop',
   po_dir: po_dir,
   install: true,
diff --git a/meson.build b/meson.build
index ea2d7f75..15e3068c 100644
--- a/meson.build
+++ b/meson.build
@@ -27,6 +27,13 @@ po_dir = meson.source_root() / 'po'
 datadir = seahorse_prefix / get_option('datadir')
 libexecbindir = seahorse_prefix / get_option('libexecdir') / meson.project_name()
 
+# Application ID
+if get_option('profile') == 'default'
+  application_id = 'org.gnome.seahorse.Application'
+else
+  application_id = 'org.gnome.seahorse.ApplicationDevel'
+endif
+
 # Dependencies
 min_glib_version = '2.44'
 min_gcr_version = '3.11.91'
@@ -119,6 +126,7 @@ conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.p
 conf.set_quoted('PKGDATADIR', get_option('datadir') / meson.project_name())
 conf.set_quoted('EXECDIR', libexecbindir)
 conf.set_quoted('LOCALEDIR', seahorse_prefix / get_option('localedir'))
+conf.set_quoted('APPLICATION_ID', application_id)
 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
 conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
 conf.set('WITH_DEBUG', buildtype.contains('debug'))
diff --git a/meson_options.txt b/meson_options.txt
index a8ca960f..b9dd441b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,5 @@
 option('help', type: 'boolean', value: true, description: 'Build help')
+option('profile', type: 'combo', choices: [ 'default', 'development' ], value: 'default', description: 
'Indicate whether this is a nightly build (used for CI purposes)')
 option('pgp-support', type: 'boolean', value: true, description: 'Add support PGP keys')
 option('check-compatible-gpg', type: 'boolean', value: true, description: 'Perform a rudimentary check if 
the GPG and GPG versions are compatible')
 option('pkcs11-support', type: 'boolean', value: true, description: 'Add support for PKCS#11 objects')
diff --git a/src/application.vala b/src/application.vala
index f21ea66f..a2afde9a 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -68,7 +68,7 @@ public class Seahorse.Application : Gtk.Application {
 
     public Application () {
         GLib.Object (
-            application_id: "org.gnome.seahorse.Application",
+            application_id: Config.APPLICATION_ID,
             flags: ApplicationFlags.HANDLES_OPEN
         );
         this.search_provider = new SearchProvider(this);


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