[mutter/wip/carlosg/code-style-checks: 3/4] ci: Add job to check code style




commit 04af0d23178e57a5a140f771a11e8458b0d9fc94
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 8 16:01:23 2021 +0200

    ci: Add job to check code style
    
    At the moment, allow the task to fail, while we smooth out the
    uncrustify configuration.

 .gitlab-ci.yml | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 44c91dd842..8844fa93d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,6 +5,7 @@ include:
 stages:
  - review
  - prepare
+ - code-review
  - build
  - test
  - coverage
@@ -12,9 +13,9 @@ stages:
 .mutter.fedora:34@common:
   variables:
     FDO_DISTRIBUTION_VERSION: 34
-    BASE_TAG: '2021-07-07.1'
+    BASE_TAG: '2021-07-08.1'
     FDO_UPSTREAM_REPO: GNOME/mutter
-    FDO_DISTRIBUTION_PACKAGES: 'gdm gnome-shell xorg-x11-server-Xvfb sassc gcovr'
+    FDO_DISTRIBUTION_PACKAGES: 'gdm gnome-shell xorg-x11-server-Xvfb sassc gcovr uncrustify'
 
     FDO_DISTRIBUTION_EXEC: |
       dnf install -y 'dnf-command(builddep)' &&
@@ -130,6 +131,24 @@ build-fedora-container@aarch64:
   variables:
     GIT_STRATEGY: none
 
+check-code-style:
+  extends:
+    - .fdo.distribution-image@fedora
+    - .mutter.fedora:34@x86_64
+  stage: code-review
+  needs:
+    - build-fedora-container@x86_64
+  script:
+    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
+      then
+        git fetch origin master;
+        export common_parent_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list 
--first-parent "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list 
--first-parent HEAD) | head -1) ;
+        python3 -u ./check-style.py --dry-run --sha $common_parent_sha ;
+      else
+        echo "Not a merge request" ;
+      fi
+  allow_failure: true
+
 .build-mutter:
   extends:
     - .fdo.distribution-image@fedora


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