ci: use shellcheck for .gitlab-ci/container/ directory
It checks our CI shell code in `debian-build-testing` job. Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com> Signed-off-by: David Heidelberg <david.heidelberg@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17574>
This commit is contained in:
committed by
Marge Bot
parent
c90b433f18
commit
fc410b024d
23
.gitlab-ci/run-shellcheck.sh
Executable file
23
.gitlab-ci/run-shellcheck.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CHECKPATH=".gitlab-ci/container" # TODO: expand to cover whole .gitlab-ci/
|
||||
|
||||
is_bash() {
|
||||
[[ $1 == *.sh ]] && return 0
|
||||
[[ $1 == */bash-completion/* ]] && return 0
|
||||
[[ $(file -b --mime-type "$1") == text/x-shellscript ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
while IFS= read -r -d $'' file; do
|
||||
if is_bash "$file" ; then
|
||||
shellcheck -x -W0 -s bash "$file"
|
||||
rc=$?
|
||||
if [ "${rc}" -eq 0 ]
|
||||
then
|
||||
continue
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done < <(find $CHECKPATH -type f \! -path "./.git/*" -print0)
|
||||
Reference in New Issue
Block a user