Skip to content

ci: adopt wordpress-configs reusables @db1f56b #65

ci: adopt wordpress-configs reusables @db1f56b

ci: adopt wordpress-configs reusables @db1f56b #65

Workflow file for this run

name: Tests
on:
push:
branches: [trunk]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
unit:
name: Unit
uses: ahegyes/wordpress-configs/.github/workflows/reusable-phpunit.yml@db1f56b3c96ae1fae91eb10ec162ba8095b904ad
with:
php-version: '8.5'
composer-script: 'test:unit'
needs-wp-env: false
integration:
name: Integration (${{ matrix.label }})
strategy:
fail-fast: false
matrix:
include:
# Pinned for a deterministic gate.
- label: 'WP 7.0 (floor)'
php-version: '8.5'
wp-env-core: 'WordPress/WordPress#tags/7.0'
# Graceful-failure path: WP 6.9.4 is below the framework's 7.0 floor.
# Exercises check_requirements returning WP_Error with
# plugin_wp_incompatible. Validates that the framework correctly
# blocks plugin init on an incompatible WP runtime.
- label: 'WP 6.9.4 (below floor)'
php-version: '8.5'
wp-env-core: 'WordPress/WordPress#tags/6.9.4'
uses: ahegyes/wordpress-configs/.github/workflows/reusable-phpunit.yml@db1f56b3c96ae1fae91eb10ec162ba8095b904ad
with:
php-version: ${{ matrix.php-version }}
wp-env-core: ${{ matrix.wp-env-core }}
composer-script: 'test:integration'
node-version: '24'
wp-env-config-file: '.wp-env.tests.json'
smoke:
name: Consumer Smoke
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240
with:
php-version: '8.5'
coverage: none
tools: composer:v2
- name: Install consumer-smoke fixture
uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6
with:
working-directory: tests/Fixtures/consumer-smoke
composer-options: '--prefer-dist'
- name: Run smoke
working-directory: tests/Fixtures/consumer-smoke
run: composer smoke
- name: Assert scoped output sanity
working-directory: tests/Fixtures/consumer-smoke
run: |
set -e
diff vendor/php-di/php-di/src/Compiler/Template.php dependencies/php-di/php-di/src/Compiler/Template.php
if grep -rqF 'DWS_CONSUMER_SMOKE_Deps\WP_Error' dependencies/ahegyes/wp-framework-bootstrap/; then
echo "FAIL: WP_Error got prefixed inside scoped bootstrap" >&2
exit 1
fi
if ! grep -qF 'namespace DWS_CONSUMER_SMOKE_Deps\DeepWebSolutions\Framework\Core' dependencies/ahegyes/wp-framework-core/src/PluginKernel.php; then
echo "FAIL: PluginKernel.php missing scoped namespace declaration" >&2
exit 1
fi
if grep -qF 'DWS_CONSUMER_SMOKE_Deps\Psr\Container' dependencies/ahegyes/wp-framework-core/src/PluginKernel.php; then
echo "FAIL: Psr\\Container namespace got prefixed" >&2
exit 1
fi
# Framework text domains are rewritten to the consumer's domain at scope time, so framework strings ship translatable under the consumer's catalog.
if grep -rqF "'wp-framework-" dependencies/; then
echo "FAIL: a 'wp-framework-*' text domain survived scoping; the textdomain patcher did not run" >&2
grep -rnF "'wp-framework-" dependencies/ >&2
exit 1
fi
if ! grep -rqF "'consumer-smoke'" dependencies/ahegyes/wp-framework-bootstrap/; then
echo "FAIL: framework strings were not rewritten to the consumer text domain" >&2
exit 1
fi
# WooCommerce runtime symbols are host-provided; scoping must leave them unprefixed.
if grep -rqE 'DWS_CONSUMER_SMOKE_Deps\\(WC_|wc_|WooCommerce)' dependencies/ahegyes/wp-framework-woocommerce/; then
echo "FAIL: a WooCommerce symbol got prefixed inside scoped woocommerce" >&2
grep -rnE 'DWS_CONSUMER_SMOKE_Deps\\(WC_|wc_|WooCommerce)' dependencies/ahegyes/wp-framework-woocommerce/ >&2
exit 1
fi
if ! grep -rqF '\wc_get_order(' dependencies/ahegyes/wp-framework-woocommerce/; then
echo "FAIL: expected an unprefixed WooCommerce call in scoped woocommerce" >&2
exit 1
fi