From be273475c9652f9b089449b79d62fefbb3c6ace1 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Sun, 30 Jan 2022 01:46:46 +0000 Subject: [PATCH] Add tests --- tests/00-selfsanity.sh | 7 +++++++ tests/01-yamllint.sh | 6 ++++++ tests/02-ansiblelint.sh | 6 ++++++ tests/Makefile | 4 ++++ 4 files changed, 23 insertions(+) create mode 100755 tests/00-selfsanity.sh create mode 100755 tests/01-yamllint.sh create mode 100755 tests/02-ansiblelint.sh create mode 100644 tests/Makefile diff --git a/tests/00-selfsanity.sh b/tests/00-selfsanity.sh new file mode 100755 index 0000000..504d2df --- /dev/null +++ b/tests/00-selfsanity.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +cd "$(dirname "$0")" + +find . -maxdepth 1 -type f -name "*.sh" -print0 | xargs -0 -t -n 1 shellcheck -- diff --git a/tests/01-yamllint.sh b/tests/01-yamllint.sh new file mode 100755 index 0000000..a6c8c99 --- /dev/null +++ b/tests/01-yamllint.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cd "$(dirname "$0")/.." || exit 1 + +find . -type f -name "*.yml" -not -path "./playbooks/roles/*" -print0 | \ + xargs -0 -t -n 1 yamllint -s -- diff --git a/tests/02-ansiblelint.sh b/tests/02-ansiblelint.sh new file mode 100755 index 0000000..cc01be0 --- /dev/null +++ b/tests/02-ansiblelint.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cd "$(dirname "$0")/.." || exit 1 + +find . -mindepth 1 -maxdepth 1 -type d '!' -name ".*" -not -path "./tests" -print0 | \ + xargs -0 -t -n 1 -- ansible-lint -x meta-no-info -- diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..ad6107f --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,4 @@ +.PHONY = all + +all: + @for x in *.sh ; do sh "$$x" || exit 1 ; done