From 1fa12d4f138bd18ef0ce7aec7cf61c72ee431a77 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Sat, 29 Oct 2022 19:05:24 +0000 Subject: [PATCH] Add yamllint and ansible-lint tests --- tests/00-selfsanity.sh | 7 +++++++ tests/01-yamllint.sh | 7 +++++++ tests/02-ansible-lint.sh | 8 ++++++++ tests/Makefile | 4 ++++ 4 files changed, 26 insertions(+) create mode 100644 tests/00-selfsanity.sh create mode 100644 tests/01-yamllint.sh create mode 100644 tests/02-ansible-lint.sh create mode 100644 tests/Makefile diff --git a/tests/00-selfsanity.sh b/tests/00-selfsanity.sh new file mode 100644 index 0000000..020526c --- /dev/null +++ b/tests/00-selfsanity.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +cd "$(dirname "$0")" || exit 1 + +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 100644 index 0000000..4fb3f75 --- /dev/null +++ b/tests/01-yamllint.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +cd "$(dirname "$0")/.." || exit 1 + +find . -type f -name "*.yml" -print0 | xargs -0 -t -n 1 yamllint -s -- diff --git a/tests/02-ansible-lint.sh b/tests/02-ansible-lint.sh new file mode 100644 index 0000000..5ca54ca --- /dev/null +++ b/tests/02-ansible-lint.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -eu + +cd "$(dirname "$0")/../roles" || exit 1 + +find . -mindepth 1 -maxdepth 1 -type d '!' -name ".*" -print0 | \ + xargs -0 -t -n 1 ansible-lint -x 701 -- 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