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:
David Heidelberg
2022-08-10 15:27:31 +02:00
committed by Marge Bot
parent c90b433f18
commit fc410b024d
4 changed files with 32 additions and 7 deletions

View File

@@ -171,6 +171,7 @@ debian-build-testing:
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,xvmc,lima,panfrost,asahi
script:
- .gitlab-ci/lava/lava-pytest.sh
- .gitlab-ci/run-shellcheck.sh
- .gitlab-ci/meson/build.sh
- .gitlab-ci/run-shader-db.sh

View File

@@ -48,6 +48,7 @@ apt-get install -y --no-remove \
python3-pytest \
procps \
spirv-tools \
shellcheck \
strace \
time \
zstd

View File

@@ -1,21 +1,21 @@
variables:
DEBIAN_X86_BUILD_BASE_IMAGE: "debian/x86_build-base"
DEBIAN_BASE_TAG: "2022-08-22-drop-llvm9"
DEBIAN_BASE_TAG: "2022-08-25-shellcheck"
DEBIAN_X86_BUILD_IMAGE_PATH: "debian/x86_build"
DEBIAN_BUILD_TAG: "2022-08-23-mold"
DEBIAN_BUILD_TAG: "2022-08-25-shellcheck"
DEBIAN_X86_BUILD_MINGW_IMAGE_PATH: "debian/x86_build-mingw"
DEBIAN_BUILD_MINGW_TAG: "2022-08-17-bump"
DEBIAN_BUILD_MINGW_TAG: "2022-08-25-shellcheck"
DEBIAN_X86_TEST_BASE_IMAGE: "debian/x86_test-base"
DEBIAN_X86_TEST_IMAGE_PATH: "debian/x86_test-gl"
DEBIAN_X86_TEST_GL_TAG: "2022-08-17-bump"
DEBIAN_X86_TEST_VK_TAG: "2022-08-17-bump"
DEBIAN_X86_TEST_GL_TAG: "2022-08-25-shellcheck"
DEBIAN_X86_TEST_VK_TAG: "2022-08-25-shellcheck"
FEDORA_X86_BUILD_TAG: "2022-08-23-mold"
KERNEL_ROOTFS_TAG: "2022-08-17-bump"
FEDORA_X86_BUILD_TAG: "2022-08-25-shellcheck"
KERNEL_ROOTFS_TAG: "2022-08-25-shellcheck"
WINDOWS_X64_VS_PATH: "windows/x64_vs"
WINDOWS_X64_VS_TAG: "2022-08-17-bump"

23
.gitlab-ci/run-shellcheck.sh Executable file
View 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)