[geary/wip/187-flatpak-ci-wrong-branch] Update Gitlab CI Flatpak build with standard template



commit 7504cf760eff6413b59b8c1f99d9c64012937d8b
Author: Michael Gratton <mike vee net>
Date:   Wed Jan 16 10:21:42 2019 +1100

    Update Gitlab CI Flatpak build with standard template
    
    See: https://gitlab.gnome.org/GNOME/citemplates

 .gitlab-ci.yml | 114 +++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 87 insertions(+), 27 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 887b6036..0e585cd1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,6 +11,8 @@ variables:
   BUILD_CMD: ninja -v -C $BUILD_DIR
   TEST_CMD: xvfb-run meson test -v --no-stdsplit -C $BUILD_DIR
   INSTALL_CMD: ninja -v -C $BUILD_DIR install
+
+  # Fedora packages
   FEDORA_DEPS: vala gobject-introspection-devel
                meson desktop-file-utils libcanberra-devel libgee-devel
                glib2-devel gmime-devel gtk3-devel libnotify-devel sqlite-devel
@@ -18,6 +20,8 @@ variables:
                gcr-devel enchant-devel libunwind-devel iso-codes-devel
                gnome-online-accounts-devel itstool json-glib-devel
   FEDORA_TEST_DEPS: Xvfb tar xz
+
+  # Ubuntu & Debian packages
   UBUNTU_DEPS: valac libgirepository1.0-dev
                meson desktop-file-utils libcanberra-dev
                libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev libgtk-3-dev
@@ -27,9 +31,16 @@ variables:
                libmessaging-menu-dev libunity-dev libjson-glib-dev
   UBUNTU_TEST_DEPS: xauth xvfb
 
-#
-# Stages
-#
+  # Flatpak vars
+  BUNDLE: geary-dev.flatpak
+  FLATPAK_MODULE: geary
+  GIT_SUBMODULE_STRATEGY: normal
+  MANIFEST_PATH: org.gnome.Geary.json
+  RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
+
+stages:
+  - build
+  - deploy
 
 fedora:
   stage: build
@@ -64,33 +75,82 @@ deb-package:
   script:
     - dpkg-buildpackage -b -us -uc
 
-flatpack-package:
-  image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
-  stage: build
-
-  variables:
-    GIT_SUBMODULE_STRATEGY: normal
-    FLATPAK_ARTIFACT: geary-git.flatpak
-
+flatpak:
+  image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
+  stage: 'build'
   script:
-    - flatpak-builder flatpak-build org.gnome.Geary.json
-    - flatpak build-export flatpak-repo flatpak-build --update-appstream
-    - flatpak build-bundle flatpak-repo $FLATPAK_ARTIFACT
-        --runtime-repo=https://sdk.gnome.org/gnome-nightly.flatpakrepo
-        org.gnome.Geary
-
+    - 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
+    - flatpak build app meson --prefix=/app ${MESON_ARGS} _build
+    - flatpak build app ninja -C _build install
+    - flatpak-builder --finish-only --repo=repo app ${MANIFEST_PATH}
+    # Run automatic tests inside the Flatpak env
+    - >
+      xvfb-run -a -s "-screen 0 1024x768x24"
+      flatpak build
+      --env=LANG=C.UTF-8
+      --env=NO_AT_BRIDGE=1
+      app
+      dbus-run-session
+      meson test -C _build --no-stdsplit --print-errorlogs
+    # Generate a Flatpak bundle
+    - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID}
   artifacts:
+    when: 'always'
     paths:
-      - $FLATPAK_ARTIFACT
+      - "${BUNDLE}"
+      - '_build/meson-logs/meson-log.txt'
+      - '_build/meson-logs/testlog.txt'
     expire_in: 2 days
-
   cache:
-    # JOB_NAME - Each job will have it's own cache
-    # COMMIT_REF_SLUG = Lowercase name of the branch
-    # ^ Keep diffrerent caches for each branch
-    key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    key: "$CI_JOB_NAME"
     paths:
-      # Cache .flatpak-builder
-      - .flatpak-builder/cache/
-      - .flatpak-builder/downloads/
-      - .flatpak-builder/git/
+      - '.flatpak-builder/downloads'
+      - '.flatpak-builder/git'
+  except:
+    variables:
+      # Don't run for translation commits
+      - $CI_COMMIT_TITLE =~ /^Update.*translation$/
+
+review:
+  stage: 'deploy'
+  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:
+    refs:
+      - 'tags'
+      # No need to run on the upstream master branch either
+      - 'master'
+      # don't run on stable branches
+      - /^gnome-\d-\d\d$/
+    variables:
+      # Don't run for translation commits
+      - $CI_COMMIT_TITLE =~ /^Update.*translation$/
+
+stop_review:
+  stage: 'deploy'
+  script:
+    - echo "Stopping Flatpak deployment"
+  when: 'manual'
+  environment:
+    name: review/$CI_COMMIT_REF_NAME
+    action: 'stop'
+  except:
+    refs:
+      - 'tags'
+      # No need to run on the upstream master branch either
+      - 'master'
+      # don't run on stable branches
+      - /^gnome-\d-\d\d$/
+    variables:
+      # Don't run for translation commits
+      - $CI_COMMIT_TITLE =~ /^Update.*translation$/


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