[nautilus/alatiera/poking-ci: 1/2] CI: Factorout flatpak job into a template



commit fdceab2405d2690279b609b4eeb08226c4562480
Author: Jordan Petridis <jpetridis gnome org>
Date:   Tue Oct 9 13:57:19 2018 +0300

    CI: Factorout flatpak job into a template

 .gitlab-ci.yml | 100 ++++++++++++++++-----------------------------------------
 1 file changed, 28 insertions(+), 72 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cce53c189..2fc16c2f7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,18 +13,7 @@ stages:
       - cd _build
       - ninja test
 
-flatpak:
-    image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.30
-    stage: test
-    variables:
-        MANIFEST_PATH: "build-aux/flatpak/org.gnome.Nautilus.yml"
-        MESON_ARGS: "-Dprofile=Devel -Dtests=all"
-        FLATPAK_MODULE: "nautilus"
-        RUNTIME_REPO: "https://sdk.gnome.org/gnome.flatpakrepo";
-        DBUS_ID: "org.gnome.NautilusDevel"
-
-    before_script:
-        - tar -xzf cache.tar.gz .flatpak-builder/cache/ || true
+.flatpak_template: &flatpak
     script:
         - flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
         # Make sure to keep this in sync with the Flatpak manifest, all arguments
@@ -33,7 +22,16 @@ flatpak:
         - 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 app ninja -C _build test
+        # Setting LANG to avoid Tracker complaining and falling back to the same value,
+        # and setting NO_AT_BRIDGE, so that atk-bridge isn’t initialized, preventing
+        # annoying warnings that don’t affect the kinds of tests that we run.
+        - |
+          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
         # Generate a Flatpak bundle
         - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${DBUS_ID}
     artifacts:
@@ -44,15 +42,23 @@ flatpak:
         # won’t be one in case of failure, but the logs will be available for
         # our expert investigators to dissect.
         when: always
-        expire_in: 30 days
-    cache:
-        paths:
-            - cache.tar.gz
+        expire_in: 2 days
+
+flatpak devel:
+    image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.30
+    stage: test
+    variables:
+        MANIFEST_PATH: "build-aux/flatpak/org.gnome.Nautilus.yml"
+        MESON_ARGS: "-Dprofile=Devel -Dtests=all"
+        FLATPAK_MODULE: "nautilus"
+        RUNTIME_REPO: "https://sdk.gnome.org/gnome.flatpakrepo";
+        DBUS_ID: "org.gnome.NautilusDevel"
+    <<: *flatpak
 
 review:
     stage: deploy
     dependencies:
-        - flatpak
+        - "flatpak devel"
     script:
         - echo "Generating flatpak deployment"
     artifacts:
@@ -144,7 +150,7 @@ opensuse:tumbleweed:
         - web
         - tags
 
-flatpak:master:
+flatpak master:
     image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
     stage: cross_environment
     variables:
@@ -153,44 +159,13 @@ flatpak:master:
         FLATPAK_MODULE: "nautilus"
         RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
         DBUS_ID: "org.gnome.NautilusMaster"
-
-    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
-        - flatpak build app meson --prefix=/app --libdir=lib ${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
-        # Setting LANG to avoid Tracker complaining and falling back to the same value,
-        # and setting NO_AT_BRIDGE, so that atk-bridge isn’t initialized, preventing
-        # annoying warnings that don’t affect the kinds of tests that we run.
-        - 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
-        # Generate a Flatpak bundle
-        - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${DBUS_ID}
-    artifacts:
-        paths:
-            - ${BUNDLE}
-            - _build/meson-logs/
-        # The Flatpak bundle is always generated at the end, meaning that there
-        # won’t be one in case of failure, but the logs will be available for
-        # our expert investigators to dissect.
-        when: always
-        expire_in: 30 days
-    cache:
-        paths:
-            - .flatpak-builder/cache
+    <<: *flatpak
     only:
         - schedules
         - web
         - tags
 
-flatpak:gtk4:
+flatpak gtk4:
     image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
     stage: cross_environment
     variables:
@@ -199,26 +174,7 @@ flatpak:gtk4:
         FLATPAK_MODULE: "nautilus"
         RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
         DBUS_ID: "org.gnome.NautilusGtk4"
-
-    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
-        - flatpak build app meson --prefix=/app --libdir=lib ${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 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/
-        expire_in: 30 days
-    cache:
-        paths:
-            - .flatpak-builder/cache
+    <<: *flatpak
     only:
         - schedules
         - web


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