[tracker/wip/carlosg/ci-playground: 1/4] ci: Move CI to freedesktop ci-templates




commit d9577bdbdfff186dd05571a63b31502e182e2df4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat May 15 20:18:07 2021 +0200

    ci: Move CI to freedesktop ci-templates
    
    Use ci-templates to build and test on fedora 34/rawhide, ubuntu rolling
    and alpine edge, as we used to do. One thing we don't do anymore
    is fetching eatmydata, it requires building from source in some
    distros, and it's not as much necessary anymore with expensive tests
    using memory connections.

 .gitlab-ci.yml | 216 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 183 insertions(+), 33 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 05259f6d6..f8581a010 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,8 @@
-# The container images used in this pipeline are built from this
-# GitLab project: https://gitlab.gnome.org/GNOME/tracker-oci-images
+include:
+  - remote: 
"https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/ci-fairy.yml";
+  - remote: 
'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/alpine.yml'
+  - remote: 
'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/fedora.yml'
+  - remote: 
'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/ubuntu.yml'
 
 variables:
   # These can be used to see verbose log output from the functional-tests.
@@ -10,25 +13,151 @@ variables:
   MESON_TEST_EXTRA_ARGS: ""
 
 stages:
+  - prepare
+  - build
   - test
   - analysis
   - website
 
-.test_template: &test
-  stage: test
+.tracker.fedora@common:
+  variables:
+    BASE_TAG: '2021-05-15.5'
+    FDO_UPSTREAM_REPO: GNOME/tracker
+    FDO_DISTRIBUTION_PACKAGES: 'clang gcovr git libasan libubsan python3-gobject python3-pip umockdev-devel 
xmlto'
+    FDO_DISTRIBUTION_EXEC: |
+      dnf install -y 'dnf-command(builddep)' &&
+      dnf builddep -y tracker tracker-miners --setopt=install_weak_deps=False &&
+      dnf clean all &&
+      pip3 install beautifulsoup4 mkdocs mkdocs-cinder tap.py meson
+
+.tracker.ubuntu@common:
+  variables:
+    BASE_TAG: '2021-05-15.5'
+    FDO_UPSTREAM_REPO: GNOME/tracker
+    FDO_DISTRIBUTION_PACKAGES: 'python3-tap umockdev libumockdev-dev upower asciidoc-base git'
+    FDO_DISTRIBUTION_EXEC: |
+      export DEBIAN_FRONTEND=noninteractive &&
+      sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list &&
+      apt-get -yq update && apt-get -yq upgrade &&
+      apt-get -yq build-dep tracker tracker-miners
+
+.tracker.alpine@common:
+  variables:
+    BASE_TAG: '2021-05-15.5'
+    FDO_UPSTREAM_REPO: GNOME/tracker
+    FDO_DISTRIBUTION_PACKAGES: 'alpine-sdk asciidoc bash-completion dbus dbus-dev git glib-dev 
gobject-introspection-dev gtk-doc icu-dev json-glib-dev libsoup-dev libxml2-dev meson py3-gobject3 
py3-setuptools py3-tappy sqlite-dev vala'
+
+.tracker.fedora:34@x86_64:
+  extends: .tracker.fedora@common
+  variables:
+    FDO_DISTRIBUTION_VERSION: 34
+    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
+
+.tracker.fedora:rawhide@x86_64:
+  extends: .tracker.fedora@common
+  variables:
+    FDO_DISTRIBUTION_VERSION: rawhide
+    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
+
+.tracker.ubuntu:rolling@x86_64:
+  extends: .tracker.ubuntu@common
+  variables:
+    FDO_DISTRIBUTION_VERSION: rolling
+    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
+
+.tracker.alpine:edge@x86_64:
+  extends: .tracker.alpine@common
+  variables:
+    FDO_DISTRIBUTION_VERSION: edge
+    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"
+
+build-fedora-container@x86_64:
+  extends:
+    - .fdo.container-build@fedora
+    - .tracker.fedora:34@x86_64
+  stage: prepare
+  variables:
+    GIT_STRATEGY: none
+
+build-fedora-rawhide-container@x86_64:
+  extends:
+    - .fdo.container-build@fedora
+    - .tracker.fedora:rawhide@x86_64
+  stage: prepare
+  variables:
+    GIT_STRATEGY: none
+
+build-ubuntu-container@x86_64:
+  extends:
+    - .fdo.container-build@ubuntu
+    - .tracker.ubuntu:rolling@x86_64
+  stage: prepare
+  variables:
+    GIT_STRATEGY: none
+
+build-alpine-container@x86_64:
+  extends:
+    - .fdo.container-build@alpine
+    - .tracker.alpine:edge@x86_64
+  stage: prepare
+  variables:
+    GIT_STRATEGY: none
+
+.build-template: &build
+  stage: build
+  script:
+    - meson . build -Db_lto=true -Db_coverage=true -Dsystemd_user_services=false -Dtests_tap_protocol=true 
--prefix /usr
+    - ninja -C build
+  artifacts:
+    expire_in: 1 day
+    paths:
+      - build
+
+build-fedora@x86_64:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:34@x86_64
+  needs:
+    - build-fedora-container@x86_64
+  <<: *build
+
+build-fedora-rawhide@x86_64:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:rawhide@x86_64
+  needs:
+    - build-fedora-rawhide-container@x86_64
+  <<: *build
+
+build-ubuntu-rolling@x86_64:
+  extends:
+    - .fdo.distribution-image@ubuntu
+    - .tracker.ubuntu:rolling@x86_64
+  needs:
+    - build-ubuntu-container@x86_64
+  <<: *build
 
+build-alpine-edge@x86_64:
+  extends:
+    - .fdo.distribution-image@alpine
+    - .tracker.alpine:edge@x86_64
+  needs:
+    - build-alpine-container@x86_64
+  <<: *build
+
+.test-template: &test
+  stage: test
+  variables:
+    G_SLICE: "always-malloc"
+    MALLOC_CHECK_: "3"
   script:
-    - mkdir build
     - cd build
-    - meson .. -Db_lto=true -Db_coverage=true -Dsystemd_user_services=false -Dtests_tap_protocol=true
-    - ninja
     - |
       # Remove the many "CI_" variables from the environment. Meson dumps the
       # whole environment for every failed test, and that gives a whole
       # screenful of junk each time unless we strip these.
       unset $(env|grep -o '^CI_[^=]*')
-      env LANG=C.UTF-8 LC_ALL=C.UTF-8 dbus-run-session eatmydata meson test --print-errorlogs 
${MESON_TEST_EXTRA_ARGS}
-
+      env LANG=C.UTF-8 LC_ALL=C.UTF-8 dbus-run-session meson test --print-errorlogs ${MESON_TEST_EXTRA_ARGS}
   after_script:
     - |
       echo "Distribution: "
@@ -42,51 +171,69 @@ stages:
       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:
+    expire_in: 1 day
     when: always
     paths:
-    - build/meson-logs/testlog.txt
+    - build
     reports:
       junit: "build/meson-logs/testlog.junit.xml"
 
-
-test-alpine-edge:
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/alpine:edge
+test-fedora@x86_64:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:34@x86_64
+  needs:
+    - build-fedora@x86_64
   <<: *test
 
-test-fedora-latest:
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:latest
+test-fedora-rawhide@x86_64:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:rawhide@x86_64
+  needs:
+    - build-fedora-rawhide@x86_64
   <<: *test
 
-test-ubuntu-rolling:
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/ubuntu:rolling
+test-ubuntu@x86_64:
+  extends:
+    - .fdo.distribution-image@ubuntu
+    - .tracker.ubuntu:rolling@x86_64
+  needs:
+    - build-ubuntu-rolling@x86_64
   <<: *test
 
-test-fedora-rawhide:
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:rawhide
+test-alpine@x86_64:
+  extends:
+    - .fdo.distribution-image@alpine
+    - .tracker.alpine:edge@x86_64
+  needs:
+    - build-alpine-edge@x86_64
   <<: *test
 
 coverage-analysis:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:rawhide@x86_64
   stage: analysis
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:latest
   allow_failure: true
   script:
-    - mkdir -p coverage-build/coveragereport
-    - cd coverage-build
-    - meson .. -Db_lto=true -Db_coverage=true
-    - ninja
-    - env LANG=C.UTF-8 LC_ALL=C.UTF-8 dbus-run-session eatmydata meson test --print-errorlogs 
${MESON_TEST_EXTRA_ARGS}
+    - cd build
+    - mkdir -p coveragereport
     - gcovr --html-details --print-summary --root=.. --exclude=../docs/reference --exclude=../tests 
--exclude=../utils --exclude=../examples --output coveragereport/index.html
   coverage: '/^lines: (\d+\.\d+\%)/'
   artifacts:
     when: always
     paths:
-    - coverage-build/coveragereport
+    - build/coveragereport
+  needs:
+    - test-fedora@x86_64
 
 coverity:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:rawhide@x86_64
   stage: analysis
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:latest
   allow_failure: true
   script:
     - curl https://scan.coverity.com/download/linux64 --data "token=$COVERITY_TOKEN&project=Tracker" 
--output /tmp/coverity_tool.tgz
@@ -100,19 +247,20 @@ coverity:
       --form token=$COVERITY_TOKEN --form email=carlosg gnome org
       --form file=@cov-int.tar.gz --form version="`git describe --tags`"
       --form description="gitlab CI build"
+  needs:
+    - build-fedora-rawhide-container@x86_64
   only:
     - master
 
 pages:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .tracker.fedora:rawhide@x86_64
   stage: website
-  image: registry.gitlab.gnome.org/gnome/tracker-oci-images/amd64/fedora:latest
-  dependencies: []
-  before_script:
-    - pip3 install beautifulsoup4 mkdocs mkdocs-cinder
   script:
     - export install_prefix="$(pwd)/tracker-install"
     # Build tracker and install.
-    - mkdir build; pushd build; meson .. --prefix="$install_prefix"; ninja install; popd
+    - mkdir website-build; pushd website-build; meson .. --prefix="$install_prefix"; ninja; ninja install; 
popd
     # Build tracker-miners and install any documentation from there as well.
     - .gitlab-ci/checkout-tracker-miners.sh
     - pushd extra/tracker-miners; mkdir build; pushd build; env 
PKG_CONFIG_PATH="$install_prefix/lib64/pkgconfig" meson .. --prefix="$install_prefix"; ninja install; popd; 
popd
@@ -124,6 +272,8 @@ pages:
   artifacts:
     paths:
       - public
+  needs:
+    - build-fedora-rawhide-container@x86_64
   only:
     - master
     - /^sam\/website.*$/


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