Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 4 additions & 94 deletions .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,99 +156,9 @@ jobs:
name: built-plugins
path: build

# The following steps inline wordpress/plugin-check-action to add
# "testsEnvironment": false to the auto-generated .wp-env.json.
# The upstream action's default config triggers a bug in @wordpress/env's
# legacy dual-environment startup path on the ubuntu-24.04 runner image
# >=20260525.161 (Node.js 24.16.0), where wp-env start silently exits 0
# without booting Docker. See https://github.com/WordPress/plugin-check-action/issues/579
# Revert to `uses: wordpress/plugin-check-action@...` once the upstream
# issue is resolved.
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '24'

- name: Setup wp-env
env:
BUILD_DIR: ./build/${{ matrix.plugin }}
run: |
PLUGIN_DIR=$(realpath "$BUILD_DIR")
PLUGIN_SLUG=$(basename "$PLUGIN_DIR")
echo "PLUGIN_DIR=$PLUGIN_DIR" >> "$GITHUB_ENV"
echo "PLUGIN_SLUG=$PLUGIN_SLUG" >> "$GITHUB_ENV"

# Note: plugin-check is intentionally NOT listed here — the URL
# download path appears to be where wp-env silently dies on the new
# runner image. Installed via wp-cli below instead.
cat > .wp-env.json <<EOF
{
"core": null,
"port": 8880,
"testsEnvironment": false,
"mappings": { "wp-content/plugins/${PLUGIN_SLUG}": "${PLUGIN_DIR}" }
}
EOF

# Pin @wordpress/env to a known-good version rather than tracking
# latest, so a future regression in wp-env can't silently break CI
# the way https://github.com/WordPress/gutenberg/issues/78762 just did.
# Bump intentionally when picking up upstream fixes.
npm -g --no-fund i @wordpress/env@11.7.0

- name: Start wp-env
uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0
with:
timeout_minutes: 10
max_attempts: 3
shell: bash
command: wp-env start

- name: Run plugin check
run: |
echo "::group::Debugging information"
wp-env run cli wp cli info
wp-env run cli wp plugin list
echo "::endgroup::"

echo "::group::Install plugin-check"
wp-env run cli wp plugin install plugin-check --activate
echo "::endgroup::"

echo "::group::Install dependencies"
DEPENDENCIES=$(wp-env run cli wp plugin get "$PLUGIN_SLUG" --field=requires_plugins | tr ',' ' ' | tr -d '\r')
if [ -n "${DEPENDENCIES// /}" ]; then
echo "Installing plugin dependencies: $DEPENDENCIES"
wp-env run cli wp plugin install --activate $DEPENDENCIES
else
echo "Plugin has no dependencies"
fi
echo "::endgroup::"

wp-env run cli wp plugin activate "$PLUGIN_SLUG"

echo "::group::Run Plugin Check"
RESULTS="${RUNNER_TEMP}/plugin-check-results.json"
wp-env run cli wp plugin check "$PLUGIN_SLUG" \
--format=json \
--ignore-codes=readme_reserved_contributors,WordPress.WP.I18n.TextDomainMismatch \
--slug="$PLUGIN_SLUG" \
--exclude-files=.wp-env.json \
--require=./wp-content/plugins/plugin-check/cli.php \
> "$RESULTS"
cat "$RESULTS"
echo "::endgroup::"

# Fail if Plugin Check reported any findings.
if [ -s "$RESULTS" ] && [ "$(jq 'length' "$RESULTS")" -gt 0 ]; then
echo "::error::Plugin Check reported issues for $PLUGIN_SLUG"
exit 1
fi

- name: Upload plugin-check results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: wordpress/plugin-check-action@18573eb38f13543484a1f095672dae3849a4fbb0 # main
with:
name: plugin-check-results-${{ matrix.plugin }}
path: ${{ runner.temp }}/plugin-check-results.json
if-no-files-found: ignore
build-dir: ./build/${{ matrix.plugin }}
slug: ${{ matrix.plugin }}
ignore-codes: 'readme_reserved_contributors,WordPress.WP.I18n.TextDomainMismatch'
Loading