build: add make-check step to check and generate ".gitlab-ci.yml"

This commit is contained in:
Thomas Haller 2020-11-17 09:58:27 +01:00
parent 41a684f630
commit bef8166893
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 45 additions and 0 deletions

View file

@ -5013,6 +5013,11 @@ EXTRA_DIST += \
clients/tests/test-client.check-on-disk/test_004.expected \
$(NULL)
check-local-gitlab-ci:
"$(srcdir)/tools/check-gitlab-ci.sh" "$(srcdir)"
check_local += check-local-gitlab-ci
###############################################################################
# data
###############################################################################
@ -5302,6 +5307,7 @@ EXTRA_DIST += \
tools/check-docs.sh \
tools/check-exports.sh \
tools/check-compare-generated.sh \
tools/check-gitlab-ci.sh \
tools/create-exports-NetworkManager.sh \
tools/debug-helper.py \
tools/meson-post-install.sh \

View file

@ -803,6 +803,12 @@ else
endif
endif
test(
'check-local-gitlab-ci',
find_program(join_paths(source_root, 'tools', 'check-gitlab-ci.sh')),
args: [source_root],
)
# Tests, utilities and documentation
tests = get_option('tests')
enable_tests = (tests != 'no')

33
tools/check-gitlab-ci.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -e
if [ $# -eq 0 ] ; then
BASEDIR="$(dirname "$(readlink -f "$0")")/.."
elif [ $# -eq 1 ] ; then
BASEDIR="$1"
else
echo "invalid arguments"
exit 1
fi
cd "$BASEDIR"
if ! [ -f ./.gitlab-ci.yml ] ; then
# we have no gitlab-ci. Probably this is not a git-checkout
# but a dist'ed source-tree. Nothing to check.
exit 0
fi
if ! ci-fairy --help 2>&1 >/dev/null ; then
# ci-fairy not available. Cannot check.
exit 0
fi
if [ "$NM_TEST_REGENERATE" == 1 ] ; then
ci-fairy generate-template
exit 0
fi
diff "./.gitlab-ci.yml" <(ci-fairy generate-template -o /dev/stdout)