[gnome-photos/flatpak-ci: 6/6] Add Flatpak CI, deliver bundles with each commit



commit d25edda6b0b6fe9479c686a6a54d94fea7febdef
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Sat May 19 09:25:05 2018 +0000

    Add Flatpak CI, deliver bundles with each commit
    
    For more see: https://gitlab.gnome.org/GNOME/Initiatives/wikis/DevOps-with-Flatpak

 .gitlab-ci.yml | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/basic.py |  2 +-
 2 files changed, 82 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..99757b4d
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,81 @@
+stages:
+- test
+- review
+
+variables:
+    # Replace with your preferred file name of the resulting Flatpak bundle
+    BUNDLE: "gnome-photos.flatpak"
+    GIT_SUBMODULE_STRATEGY: normal
+
+flatpak:
+    image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
+    stage: test
+    variables:
+        # Replace with your manifest path
+        MANIFEST_PATH: "flatpak/org.gnome.Photos.json"
+        RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
+        # Replace with your application name, as written in the manifest
+        FLATPAK_MODULE: "gnome-photos"
+        # Make sure to keep this in sync with the Flatpak manifest, all arguments
+        # are passed except the config-args because we build it ourselves
+        CONFIGURE_ARGS: "--disable-documentation --disable-Werror"
+        DBUS_ID: "org.gnome.Photos"
+
+    script:
+        - flatpak-builder --stop-at=${FLATPAK_MODULE} 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
+        # TODO: uncomment for meson port
+        # - flatpak build app meson --prefix=/app ${CONFIGURE_ARGS} _build
+        # - flatpak build app ninja -C _build install
+        - flatpak build app ./autogen.sh --prefix=/app --libdir=/app/lib ${CONFIGURE_ARGS}
+        - flatpak build app make install
+        - flatpak-builder --finish-only --repo=repo app ${MANIFEST_PATH}
+
+        # Run automatic tests inside the Flatpak env
+        # TODO: Enable that with the meson port
+        # - xvfb-run -a -s "-screen 0 1024x768x24" flatpak build app ninja -C _build test
+
+        # Generate a Flatpak bundle
+        - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${DBUS_ID}
+
+    artifacts:
+        paths:
+            - ${BUNDLE}
+            - _build/meson-logs/meson-log.txt
+            - _build/meson-logs/testlog.txt
+        expire_in: 30 days
+    cache:
+        paths:
+             - .flatpak-builder/cache
+
+review:
+    stage: review
+    dependencies:
+        - flatpak
+    script:
+        - echo "Generating flatpak deployment"
+    artifacts:
+        paths:
+            - ${BUNDLE}
+        expire_in: 30 days
+    environment:
+        name: review/$CI_COMMIT_REF_NAME
+        url: https://gitlab.gnome.org/$CI_PROJECT_PATH/-/jobs/$CI_JOB_ID/artifacts/raw/${BUNDLE}
+        on_stop: stop_review
+    except:
+        - master@GNOME/gnome-photos
+        - tags
+
+stop_review:
+    stage: review
+    script:
+        - echo "Stopping flatpak deployment"
+    when: manual
+    environment:
+        name: review/$CI_COMMIT_REF_NAME
+        action: stop
+    except:
+        - master@GNOME/gnome-photos
+        - tags
diff --git a/tests/basic.py b/tests/basic.py
index 1dfa17f0..2270568c 100755
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python3
 
 from testutil import *
 


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