Skip to content

Commit b4ec056

Browse files
authored
fix(update-checker): add compatibility with Bash 3.2, fixes #97 (#98)
1 parent 31e549c commit b4ec056

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

.github/scripts/update-checker.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
#!/usr/bin/env bash
22

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+
324
set -o errexit
425
set -o nounset
526

@@ -107,9 +128,13 @@ check_install_yaml() {
107128
check_test_bats() {
108129
local test_bats="tests/test.bats"
109130
local bats_files
131+
local file
110132

111133
# 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)
113138

114139
if [[ ${#bats_files[@]} -eq 0 ]]; then
115140
actions+=("tests/ directory should contain at least one .bats test file, see upstream file $UPSTREAM/tests/test.bats")

0 commit comments

Comments
 (0)