Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Update our clang_format job to the one from KDE's upstream

Dmitry Kazakov309e65ea278b
diff --git a/.gitlab-ci.script b/.gitlab-ci.script
deleted file mode 100755
index 66a8f0b8e8..0000000000
--- a/.gitlab-ci.script
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash -fxv
-
-# stop running script if a command fails
-set -e
-
-# ensure `clang-format` command points to `clang-format-11`
-update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 30
-update-alternatives --set clang-format /usr/bin/clang-format-11
-
-# download .clang-format into current directory
-wget -c --output-document=.clang-format https://invent.kde.org/frameworks/extra-cmake-modules/raw/master/kde-modules/clang-format.cmake
-
-# format source code inline
-git clang-format-11 $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA)
-
-# if files were modified, then print the diff modified that would make the proper format
-if ! git diff-index --quiet HEAD; then
- echo '*** Suggested changes to comply with KDE code conventions are below'
- echo 'You can copy below this empty line, save the content to a format.patch file, then do `patch < format.patch`'
- echo ''
- git --no-pager diff -U0
- exit 1
-fi
-
-exit 0
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d1398d0e0a..ef4bbdddb6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -91,23 +91,6 @@ variables:
coverage_format: cobertura
path: CoberturaLcovResults.xml
-clang_format:
- stage: build
- image: debian:testing
- before_script:
- - apt-get update
- - apt-get install --yes --no-install-recommends wget ca-certificates git clang-format-11
- - update-ca-certificates
- script:
- - ./.gitlab-ci.script
- rules:
- - if: $CI_PIPELINE_SOURCE == "schedule"
- when: never
- - if: $CI_COMMIT_BRANCH =~ $release_branch_pattern
- when: never
- - when: manual
- allow_failure: true
-
workflow:
rules:
# Prevent branch pipelines if an MR is open on the branch.
@@ -123,6 +106,20 @@ workflow:
- if: $CI_COMMIT_BRANCH =~ /^krita\//
- if: $CI_COMMIT_BRANCH =~ $release_branch_pattern
+.clang_format:
+ stage: build
+ allow_failure: true
+ image: invent-registry.kde.org/sysadmin/ci-images/suse-qt69:latest
+ tags:
+ - Linux
+ before_script:
+ - git clone https://invent.kde.org/sysadmin/ci-utilities.git --depth=1
+ script:
+ - git config --global --add safe.directory $CI_PROJECT_DIR
+ - if [[ ! -f .clang-format && ! -f _clang-format ]]; then wget -O .clang-format https://invent.kde.org/frameworks/extra-cmake-modules/-/raw/master/kde-modules/clang-format.cmake; fi
+ - ./ci-utilities/run-clang-format.py
+
+
include:
- local: /build-tools/ci-scripts/linux.yml
- local: /build-tools/ci-scripts/windows.yml
@@ -131,4 +128,3 @@ include:
- project: sysadmin/ci-utilities
file:
- /gitlab-templates/cppcheck.yml
-