55 lines
1.7 KiB
Bash
Executable File
55 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Root of the project directory
|
|
ROOT="$(dirname "$(realpath "$0")")"
|
|
|
|
echo "==================================="
|
|
echo " WordPress Recipe Test Suite"
|
|
echo "==================================="
|
|
echo ""
|
|
|
|
# Collect all compose files for YAML validation
|
|
COMPOSE_FILES=()
|
|
while IFS= read -r f; do
|
|
COMPOSE_FILES+=("$f")
|
|
done < <(find "$ROOT/.." -maxdepth 1 -name 'compose*.yml' | sort)
|
|
|
|
# Collect all tmpl files for shellcheck (only those with bash content)
|
|
SHELL_TMPL_FILES=()
|
|
while IFS= read -r f; do
|
|
SHELL_TMPL_FILES+=("$f")
|
|
done < <(find "$ROOT/.." -maxdepth 1 -name '*.tmpl' | sort)
|
|
|
|
# Track total failures across all test suites
|
|
failures=0
|
|
|
|
# Validate YAML syntax of all compose files
|
|
echo "========================================================================"
|
|
"$ROOT/test_yaml.sh" "${COMPOSE_FILES[@]}" || failures=$((failures + 1))
|
|
echo ""
|
|
|
|
# Lint shell scripts inside Go templates (after stripping template tags)
|
|
echo "========================================================================"
|
|
"$ROOT/test_shell.sh" "${SHELL_TMPL_FILES[@]}" || failures=$((failures + 1))
|
|
echo ""
|
|
|
|
# Render templates with fixture env files and verify expected output
|
|
echo "========================================================================"
|
|
"$ROOT/test_templates.sh" || failures=$((failures + 1))
|
|
echo ""
|
|
|
|
# Validate compose files against the Docker Compose specification
|
|
echo "========================================================================"
|
|
"$ROOT/test_compose_config.sh" || failures=$((failures + 1))
|
|
echo ""
|
|
|
|
echo "==================================="
|
|
if [ "$failures" -eq 0 ]; then
|
|
echo " All tests passed!"
|
|
else
|
|
echo " $failures test suite(s) failed"
|
|
fi
|
|
echo "==================================="
|
|
exit "$failures"
|