summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-06-13 20:58:20 +0200
committerCarlos Garnacho <carlosg@gnome.org>2021-06-17 00:58:11 +0200
commit775aee5be2e1e8cb7bde68786fac0dc3a04a3de6 (patch)
treefc48f6ba785bc5d93d1a06a1bf4aa559c1b2877d /.gitlab-ci.yml
parentf613557b5e5186cfa0ef451e5b4d7e57782cba69 (diff)
downloadtracker-775aee5be2e1e8cb7bde68786fac0dc3a04a3de6.tar.gz
ci: Check code style in merge request changes
Use the new check-style script to check the code style for all changes in a merge request, in order to suggest changes to conform to it. However, allow these checks to fail, so they are more of a hint while the uncrustify configuration is tested to be correct, we decide to enforce the style, etc. As the script requires uncrustify, ensure it's installed in the Fedora image, and use it to run the check.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml18
1 files changed, 16 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2cb98c926..01b2bd597 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,6 +16,7 @@ variables:
stages:
- review
- prepare
+ - code-review
- build
- test
- analysis
@@ -59,9 +60,9 @@ check-merge-request:
.tracker.fedora@common:
variables:
- BASE_TAG: '2021-05-15.9'
+ BASE_TAG: '2021-06-13.2'
FDO_UPSTREAM_REPO: GNOME/tracker
- FDO_DISTRIBUTION_PACKAGES: 'clang clang-analyzer gcovr git libasan libubsan python3-gobject python3-pip umockdev-devel xmlto'
+ FDO_DISTRIBUTION_PACKAGES: 'clang clang-analyzer gcovr git libasan libubsan python3-gobject python3-pip umockdev-devel xmlto uncrustify patch diffutils'
FDO_DISTRIBUTION_EXEC: |
dnf install -y 'dnf-command(builddep)' &&
dnf builddep -y tracker tracker-miners --setopt=install_weak_deps=False &&
@@ -172,6 +173,19 @@ build-alpine-container@x86_64:
- check-commit-log
- check-merge-request
+check-code-style:
+ extends:
+ - .fdo.distribution-image@fedora
+ - .tracker.fedora:34@x86_64
+ needs:
+ - build-fedora-container@x86_64
+ stage: code-review
+ script:
+ - 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 ;
+ allow_failure: true
+
.build-template: &build
stage: build
script: