From 117027d9fd5a556c25b410e2201b294493ad5c14 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 8 Jul 2021 16:01:23 +0200 Subject: [PATCH] ci: Add job to check code style At the moment, allow the task to fail, while we smooth out the uncrustify configuration. Part-of: --- .gitlab-ci.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 507444d90..697c71f05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ include: stages: - review - prepare + - code-review - build - test - analyze @@ -15,8 +16,8 @@ variables: .mutter.fedora:34@common: variables: FDO_DISTRIBUTION_VERSION: 34 - BASE_TAG: '2021-08-01.0' - FDO_DISTRIBUTION_PACKAGES: 'gdm gnome-shell xorg-x11-server-Xvfb sassc gcovr clang' + BASE_TAG: '2021-08-22.0' + FDO_DISTRIBUTION_PACKAGES: 'gdm gnome-shell xorg-x11-server-Xvfb sassc gcovr clang uncrustify' FDO_DISTRIBUTION_EXEC: | dnf install -y 'dnf-command(builddep)' && @@ -140,6 +141,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