[tracker-miners/sam/2.3-ci] ci: Test on Ubuntu



commit 018a00b0dfe2a90076a3fd62d522145cece53bba
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Apr 25 12:24:31 2020 +0200

    ci: Test on Ubuntu
    
    Inspired by https://gitlab.gnome.org/GNOME/tracker/-/issues/161#note_779489

 .gitlab-ci.yml                 | 46 ++++++++++++++++++++++++++++++++----------
 .gitlab-ci/checkout-tracker.sh | 37 +++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 11 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ab0d3ccfd..9b2d2c11f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,20 +4,20 @@
 stages:
   - test
 
-test-fedora-latest:
+variables:
+  # These can be used to see verbose log output from the functional-tests.
+  # See HACKING.md for more information.
+  G_MESSAGES_DEBUG: "Tracker"
+  TRACKER_VERBOSITY: "1"
+  TRACKER_TESTS_VERBOSE: "no"
+
+.test_template: &test
   stage: test
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:latest
 
   script:
     # We can build and test tracker-miners against tracker just by building
     # tracker as a submodule.
-    #
-    # Note that this approach doesn't currently work for the functional-tests,
-    # they require the ontologies and domain rules from tracker to be installed
-    # 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 -b 
tracker-2.3'
+    - 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'
     - su tracker -c 'cd build; ninja'
@@ -27,9 +27,33 @@ test-fedora-latest:
       # screenful of junk each time unless we strip these.
       unset $(env|grep -o '^CI_[^=]*')
 
-      su tracker -c 'cd build; dbus-run-session -- env LANG=C.UTF8 LC_ALL=C.UTF8 eatmydata meson test 
--suite tracker-miners --print-errorlogs'
+      su tracker -c 'cd build; dbus-run-session -- env LANG=C.UTF-8 LC_ALL=C.UTF-8 eatmydata meson test 
--suite tracker-miners --print-errorlogs'
+
+  after_script:
+    - |
+      echo "Distribution: "
+      echo
+      egrep '^NAME=|^VERSION=' /etc/os-release
+      echo
+      echo "Test suite settings:"
+      echo
+      echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
+      echo "TRACKER_VERBOSITY: ${TRACKER_VERBOSITY}"
+      echo "TRACKER_TESTS_VERBOSE: ${TRACKER_TESTS_VERBOSE}"
+      echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
+      echo
+      echo "These values can be set at https://gitlab.gnome.org/GNOME/tracker/pipelines/new";
 
   artifacts:
     when: always
     paths:
-    - build/meson-logs/testlog.txt
+    - build/meson-logs/*.txt
+
+
+test-fedora-latest:
+  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:latest
+  <<: *test
+
+test-ubuntu-rolling:
+  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/ubuntu:rolling
+  <<: *test
diff --git a/.gitlab-ci/checkout-tracker.sh b/.gitlab-ci/checkout-tracker.sh
new file mode 100644
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]