|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
| 3 | +# DDEV Add-on Update Checker |
| 4 | +# |
| 5 | +# This script validates that a DDEV add-on follows the current template standards. |
| 6 | +# It checks various files and configurations to ensure compatibility and best practices: |
| 7 | +# - README.md badges and documentation |
| 8 | +# - install.yaml configuration and version constraints |
| 9 | +# - Test files (*.bats) structure and requirements |
| 10 | +# - GitHub workflows and templates |
| 11 | +# - Docker Compose files for offline usage support |
| 12 | +# - File formatting (trailing newlines, whitespace) |
| 13 | +# - Proper shebangs in command files |
| 14 | +# |
| 15 | +# Usage (run from the add-on root directory): |
| 16 | +# curl -fsSL https://ddev.com/s/addon-update-checker.sh | bash |
| 17 | +# |
| 18 | +# Note: This script is removed from add-ons created from this template. |
| 19 | +# Add-on developers should always use the remote version via curl. |
| 20 | +# |
| 21 | +# Test Bash 3.2 compatibility (for template maintainers): |
| 22 | +# docker run --rm -v "$(pwd)":/test -w /test bash:3.2 /test/.github/scripts/update-checker.sh |
| 23 | + |
3 | 24 | set -o errexit |
4 | 25 | set -o nounset |
5 | 26 |
|
@@ -107,9 +128,13 @@ check_install_yaml() { |
107 | 128 | check_test_bats() { |
108 | 129 | local test_bats="tests/test.bats" |
109 | 130 | local bats_files |
| 131 | + local file |
110 | 132 |
|
111 | 133 | # Find any .bats files in tests directory |
112 | | - mapfile -t bats_files < <(find tests -maxdepth 1 -name "*.bats" -type f 2>/dev/null) |
| 134 | + bats_files=() |
| 135 | + while IFS= read -r file; do |
| 136 | + [[ -n "$file" ]] && bats_files+=("$file") |
| 137 | + done < <(find tests -maxdepth 1 -name "*.bats" -type f 2>/dev/null) |
113 | 138 |
|
114 | 139 | if [[ ${#bats_files[@]} -eq 0 ]]; then |
115 | 140 | actions+=("tests/ directory should contain at least one .bats test file, see upstream file $UPSTREAM/tests/test.bats") |
|
0 commit comments