From d4b6f246e6a16110650a57185b3d9b5acb579cf1 Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Sat, 6 Apr 2024 22:32:02 +0200 Subject: move ci --- .scripts.d/10-check.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .scripts.d/10-check.sh (limited to '.scripts.d/10-check.sh') diff --git a/.scripts.d/10-check.sh b/.scripts.d/10-check.sh new file mode 100644 index 0000000..e8ddf59 --- /dev/null +++ b/.scripts.d/10-check.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# vim: ai:ts=8:sw=8:noet +set -EeufCo pipefail +export SHELLOPTS # propagate set to children by default +IFS=$'\t\n' + +# check required commands are in place +command -v shellcheck >/dev/null 2>&1 || { + echo 'please install shellcheck' + exit 1 +} +command -v hadolint >/dev/null 2>&1 || { + echo 'please install hadolint' + exit 1 +} +command -v yamllint >/dev/null 2>&1 || { + echo 'please install yamllint' + exit 1 +} + +# check all the Dockerfiles with hadolint +find . \ + -type f \ + -name 'Dockerfile' \ + -print0 | + xargs -0 -r hadolint + +# check all the yaml files with yamllint +find . -type f \ + -regex '.*\.ya?ml\(lint\)?' \ + -print0 | + xargs -0 -r yamllint -s + +# check all sh files with shellcheck +find . \ + -type f \ + -name '*.sh' \ + -print0 | + xargs -0 -r shellcheck -- cgit v1.2.3