[mutter/gbsneto/better-ci] ci: Build GNOME Shell at the test stage



commit 72b8c6a90c2d8dbce527d7f0644dab90b5b2c336
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Apr 22 14:54:11 2019 -0300

    ci: Build GNOME Shell at the test stage
    
    Hopefully this will allow us prevent merging branches
    that accidentally break GNOME Shell.

 .gitlab-ci.yml                     | 12 ++++++++++++
 .gitlab-ci/checkout-gnome-shell.sh | 31 +++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 09b0052c5..d70dc91fd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,3 +42,15 @@ test-mutter:
   only:
     - merge_requests
     - /^.*$/
+
+can-build-gnome-shell:
+  stage: test
+  dependencies:
+    - test-mutter
+  script:
+    - .gitlab-ci/checkout-gnome-shell.sh
+    - meson gnome-shell gnome-shell/_build --prefix=/usr
+    - ninja -C mutter/_build install
+  only:
+    - merge_requests
+    - /^.*$/
diff --git a/.gitlab-ci/checkout-gnome-shell.sh b/.gitlab-ci/checkout-gnome-shell.sh
new file mode 100644
index 000000000..0149560d5
--- /dev/null
+++ b/.gitlab-ci/checkout-gnome-shell.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/bash
+
+mutter_branch=$(git describe --contains --all HEAD)
+gnome_shell_target=
+
+git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
+
+if [ $? -ne 0 ]; then
+  echo Checkout failed
+  exit 1
+fi
+
+cd gnome-shell
+
+if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
+  merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//mutter/gnome-shell}
+  merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
+
+  echo Looking for $merge_request_branch on remote ...
+  if git fetch $merge_request_remote $merge_request_branch >/dev/null 2>&1; then
+    gnome_shell_target=FETCH_HEAD
+  fi
+fi
+
+if [ -z "$gnome_shell_target" ]; then
+  gnome_shell_target=$(git branch -r -l $mutter_branch)
+  gnome_shell_target=${gnome_shell_target:-origin/master}
+  echo Using $gnome_shell_target instead
+fi
+
+git checkout $gnome_shell_target


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