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



commit 2f4175f7cf60f543be7c36eeabec17e82b840036
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 ++
 meson.build          |  8 ++++++++
 meson_options.txt    |  1 +
 src/application.vala |  2 +-
 5 files changed, 41 insertions(+), 24 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 55618355..3b620d23 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: ""
+    FLATPAK_MODULE: "seahorse"
+    RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
+    APP_ID: "org.gnome.SeahorseDevel"
+  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/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]