Run the text-domain check in a container when the runner has no PHP

The first Gitea run failed on `php: command not found`. GitHub's hosted
runners ship PHP; the Gitea runner image does not, and the whole static job
went red on one line after everything else in it had passed.

ci_php() now uses the local php when there is one — a laptop, GitHub's
runners — and a php:8.4-cli container otherwise. The repository goes in over a
tarball and `docker cp` rather than a bind mount, because a Gitea Actions job
runs inside a container talking to the HOST's docker daemon, so a host path
there lands on an empty directory nobody created.

Also: the include scan now says when it found nothing to check instead of
reporting success. Running the suite with a deliberately crippled PATH showed
it printing "0 plugin-relative include(s) checked" and then "green" — a check
passing by checking nothing, which is the same failure the PHP lint step
already guards against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kristianwind
2026-09-16 10:40:19 +02:00
co-authored by Claude Opus 5
parent f46001b513
commit 4a5e3d8879
2 changed files with 38 additions and 2 deletions
+9 -2
View File
@@ -84,7 +84,7 @@ done <<< "$(git ls-files '*.php')"
[ "$fails" = "$before" ] && echo " clean"
ci_step "text domain"
php ci/check-textdomain.php "$TEXT_DOMAIN" . || fails=$((fails + 1))
ci_php ci/check-textdomain.php "$TEXT_DOMAIN" . || fails=$((fails + 1))
ci_step "every file the plugin loads is a file the release contains"
# The bug this exists for: a new class file is written, required from the main
@@ -107,7 +107,14 @@ for path in $referenced; do
printf '%s\n' "$shipped" | grep -qx "$path" \
|| note_fail "The code loads '$path', but the release zip does not contain it. Committed?"
done
echo " $checked plugin-relative include(s) checked"
if [ "$checked" = 0 ]; then
# A check that verifies nothing must say so rather than reporting success.
# Not a failure: a single-file plugin, or one with an autoloader instead of
# a list of requires, legitimately has nothing here.
echo "::warning::No plugin-relative include was found to check. That is expected for a single-file plugin or an autoloader, and a broken scan otherwise."
else
echo " $checked plugin-relative include(s) checked"
fi
ci_step "one version, stated once"
# WordPress compares the update feed against the header and nothing else, so a