mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Add review stage to the CI checking formatting
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -82,6 +82,20 @@ stages:
|
|||||||
- update-crypto-policies --set FIPS
|
- update-crypto-policies --set FIPS
|
||||||
- update-crypto-policies --show
|
- update-crypto-policies --show
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Review #
|
||||||
|
###############################################################################
|
||||||
|
clang-format:
|
||||||
|
variables:
|
||||||
|
GIT_DEPTH: 100
|
||||||
|
stage: review
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- ./.gitlab-ci/clang-format-check.sh
|
||||||
|
only:
|
||||||
|
- merge_requests
|
||||||
|
# the format is not always matching our intentions
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# CentOS builds #
|
# CentOS builds #
|
||||||
|
|||||||
12
.gitlab-ci/clang-format-check.sh
Executable file
12
.gitlab-ci/clang-format-check.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Based on Github Action
|
||||||
|
# https://github.com/yshui/git-clang-format-lint
|
||||||
|
|
||||||
|
diff=`git-clang-format --diff --commit $CI_MERGE_REQUEST_DIFF_BASE_SHA`
|
||||||
|
[ "$diff" = "no modified files to format" ] && exit 0
|
||||||
|
[ "$diff" = "clang-format did not modify any files" ] && exit 0
|
||||||
|
|
||||||
|
printf "You have introduced coding style breakages, suggested changes:\n\n"
|
||||||
|
|
||||||
|
echo "$diff" | colordiff
|
||||||
|
exit 1
|
||||||
Reference in New Issue
Block a user