[tracker-miners/wip/carlosg/shuffle-libtracker-miner] ci: Make tracker-miners look for similarly named branches in tracker repo



commit b9dab2fb7757cfc7f201f989cf821ffeacb7e429
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Dec 12 12:53:31 2019 +0100

    ci: Make tracker-miners look for similarly named branches in tracker repo
    
    This script was borrowed from mutter, since it has similar requirements
    with gnome-shell. This make it possible to do incompatible changes along
    both repos, and still have CI pass.

 .gitlab-ci.yml                 |  2 +-
 .gitlab-ci/checkout-tracker.sh | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3c0db5132..474a17307 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,7 +26,7 @@ test-fedora-latest:
     # somewhere. It would be nice to improve the functional-tests so that they
     # will run without depending on any files outside of the build tree. Note
     # that Tracker is installed on the host here, thanks to `dnf builddep`.
-    - su tracker -c 'mkdir subprojects; cd subprojects; git clone https://gitlab.gnome.org/GNOME/tracker'
+    - su tracker -c '.gitlab-ci/checkout-tracker.sh'
     - su tracker -c 'mkdir build'
     - su tracker -c 'cd build; meson .. --prefix=/usr -Dtracker_core=subproject -Db_lto=true 
-Db_coverage=true'
     - su tracker -c 'cd build; ninja'
diff --git a/.gitlab-ci/checkout-tracker.sh b/.gitlab-ci/checkout-tracker.sh
new file mode 100755
index 000000000..6f31b69c7
--- /dev/null
+++ b/.gitlab-ci/checkout-tracker.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/bash
+
+tracker_target=
+
+mkdir subprojects
+cd subprojects
+
+git clone https://gitlab.gnome.org/GNOME/tracker.git
+
+if [ $? -ne 0 ]; then
+  echo Checkout failed
+  exit 1
+fi
+
+cd tracker
+
+if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
+  merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//tracker-miners/tracker}
+  merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
+
+  echo Looking for $merge_request_branch on remote ...
+  if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then
+    tracker_target=FETCH_HEAD
+  else
+    tracker_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
+    echo Using $tracker_target instead
+  fi
+fi
+
+if [ -z "$tracker_target" ]; then
+  tracker_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
+  tracker_target=${tracker_target:-origin/master}
+  echo Using $tracker_target instead
+fi
+
+git checkout -q $tracker_target
+


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