[tracker/wip/carlosg/ci-playground: 1/2] ci: Add review stage




commit c41eec812c9df7c0f9e1e86c31a149c343a96ef3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun May 16 15:54:47 2021 +0200

    ci: Add review stage
    
    And add checks for commit logs, and ensuring that merge requests
    have "Allow edits from maintainers" checkbox enabled. Courtesy of
    ci-fairy.

 .gitlab-ci.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 81b7e60d4..9d213e565 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,12 +14,52 @@ variables:
   MESON_TEST_EXTRA_ARGS: ""
 
 stages:
+  - review
   - prepare
   - build
   - test
   - analysis
   - website
 
+.check-template: &check
+  extends:
+    - .fdo.ci-fairy
+  stage: review
+  artifacts:
+    expire_in: 1 week
+    paths:
+      - check-junit-report.xml
+    reports:
+      junit: check-junit-report.xml
+
+check-commit-log:
+  variables:
+    GIT_DEPTH: "100"
+  script:
+    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+      then
+        ci-fairy check-commits --junit-xml=check-junit-report.xml ;
+      else
+        echo "Not a merge request" ;
+      fi
+  only:
+    - merge_requests
+  <<: *check
+
+check-merge-request:
+  variables:
+    GIT_STRATEGY: none
+  script:
+    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+      then
+        ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-junit-report.xml ;
+      else
+        echo "Not a merge request" ;
+      fi
+  only:
+    - merge_requests
+  <<: *check
+
 .tracker.fedora@common:
   variables:
     BASE_TAG: '2021-05-15.8'
@@ -30,6 +70,9 @@ stages:
       dnf builddep -y tracker tracker-miners --setopt=install_weak_deps=False &&
       dnf clean all &&
       pip3 install beautifulsoup4 mkdocs mkdocs-cinder tap.py meson
+  needs:
+    - check-commit-log
+    - check-merge-request
 
 .tracker.ubuntu@common:
   variables:
@@ -41,12 +84,18 @@ stages:
       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
+  needs:
+    - check-commit-log
+    - check-merge-request
 
 .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'
+  needs:
+    - check-commit-log
+    - check-merge-request
 
 .tracker.fedora:34@x86_64:
   extends: .tracker.fedora@common


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