From 8348f1727ad1df1b8110bfde35e491e70f0baefa Mon Sep 17 00:00:00 2001 From: Olivier Gorzalka Date: Tue, 27 Oct 2026 17:45:50 +0100 Subject: [PATCH 1/3] ci: check the template with the Pollora harness --- .github/workflows/harness.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/harness.yml diff --git a/.github/workflows/harness.yml b/.github/workflows/harness.yml new file mode 100644 index 0000000..a493c49 --- /dev/null +++ b/.github/workflows/harness.yml @@ -0,0 +1,17 @@ +name: Harness + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: {} + +jobs: + harness: + uses: Pollora/harness/.github/workflows/template.yml@v0.1.10 + with: + mode: enforce + permissions: + contents: read From c9aea464c6131efcbfff4766fae43a6c2cca2e59 Mon Sep 17 00:00:00 2001 From: Olivier Gorzalka Date: Tue, 27 Oct 2026 18:03:08 +0100 Subject: [PATCH 2/3] style: apply the Laravel preset --- %plugin_name%.php | 1 + .github/workflows/harness.yml | 2 +- bin/ci/check-install.php | 14 +++++++------- bin/replacements.php | 2 +- bin/tests/compat.php | 6 +++--- bin/tests/contract.php | 2 +- bin/tests/lib.php | 5 ++--- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/%plugin_name%.php b/%plugin_name%.php index 4d3d511..664bd26 100644 --- a/%plugin_name%.php +++ b/%plugin_name%.php @@ -1,4 +1,5 @@ getMessage()}\n"; $failed++; @@ -97,7 +97,7 @@ function run(string $command): array $process = proc_open($command.' 2>&1', $descriptors, $pipes); if (! is_resource($process)) { - throw new \RuntimeException("could not run: {$command}"); + throw new RuntimeException("could not run: {$command}"); } $out = stream_get_contents($pipes[1]) ?: ''; @@ -112,7 +112,7 @@ function wpEval(string $php): string $result = run('wp eval '.escapeshellarg($php)); if ($result['code'] !== 0) { - throw new \RuntimeException("wp eval failed: {$result['out']}"); + throw new RuntimeException("wp eval failed: {$result['out']}"); } return $result['out']; @@ -176,14 +176,14 @@ function ensureActiveTheme(): void .' --theme-version=1.0.0 --no-interaction'); if ($scaffold['code'] !== 0) { - throw new \RuntimeException("could not scaffold a theme: {$scaffold['out']}"); + throw new RuntimeException("could not scaffold a theme: {$scaffold['out']}"); } $installed = array_values(array_filter(explode("\n", run('wp theme list --field=name')['out']))); } if ($installed === []) { - throw new \RuntimeException('the site still has no theme after scaffolding one'); + throw new RuntimeException('the site still has no theme after scaffolding one'); } $active = run('wp theme list --status=active --field=name')['out']; @@ -195,7 +195,7 @@ function ensureActiveTheme(): void $activated = run('wp theme activate '.escapeshellarg($installed[0])); if ($activated['code'] !== 0) { - throw new \RuntimeException("could not activate {$installed[0]}: {$activated['out']}"); + throw new RuntimeException("could not activate {$installed[0]}: {$activated['out']}"); } } @@ -210,7 +210,7 @@ function pluginsDirectory(): string $path = wpEval('echo WP_PLUGIN_DIR;'); if ($path === '' || ! is_dir($path)) { - throw new \RuntimeException("WP_PLUGIN_DIR is {$path}, which does not exist"); + throw new RuntimeException("WP_PLUGIN_DIR is {$path}, which does not exist"); } return $path; diff --git a/bin/replacements.php b/bin/replacements.php index 3e440f2..8f81971 100644 --- a/bin/replacements.php +++ b/bin/replacements.php @@ -19,7 +19,7 @@ * placeholder the scaffolder does not substitute": a key that disappears here * or a token that appears in the template without a key both fail it. * - * @return array placeholder => a plausible substituted value + * @return array placeholder => a plausible substituted value */ function scaffolderReplacements(string $name = 'my-plugin'): array { diff --git a/bin/tests/compat.php b/bin/tests/compat.php index a359907..3d448f9 100644 --- a/bin/tests/compat.php +++ b/bin/tests/compat.php @@ -39,7 +39,7 @@ function scaffoldedPluginFile(): string $source = pluginPath('%plugin_name%.php'); if (! is_file($source)) { - throw new \RuntimeException('the template has no %plugin_name%.php — the main file was renamed'); + throw new RuntimeException('the template has no %plugin_name%.php — the main file was renamed'); } $replacements = scaffolderReplacements(TEST_SLUG); @@ -131,7 +131,7 @@ function checkRegistrationGuard(): void return str_starts_with($result['out'], 'pollora_register:plugin:'.TEST_SLUG) ? true - : "expected pollora_register:plugin:".TEST_SLUG.", got '{$result['out']}'"; + : 'expected pollora_register:plugin:'.TEST_SLUG.", got '{$result['out']}'"; }); test('Framework >= 13.32: does not also call the registrar', function () { @@ -151,7 +151,7 @@ function checkRegistrationGuard(): void return str_starts_with($result['out'], 'registrar::register:'.TEST_SLUG) ? true - : "expected registrar::register:".TEST_SLUG.", got '{$result['out']}'"; + : 'expected registrar::register:'.TEST_SLUG.", got '{$result['out']}'"; }); test('Neither is available: leaves the plugin unregistered, without a fatal', function () { diff --git a/bin/tests/contract.php b/bin/tests/contract.php index 0a2b5e8..be7d253 100644 --- a/bin/tests/contract.php +++ b/bin/tests/contract.php @@ -24,7 +24,7 @@ const CODE_NAMES = ['pollora-demo-plugin', 'PolloraDemoPlugin', 'pollora_demo_plugin', 'POLLORA_DEMO_PLUGIN']; /** - * @return array every shipped file, repository-relative + * @return array every shipped file, repository-relative */ function shippedFiles(): array { diff --git a/bin/tests/lib.php b/bin/tests/lib.php index 78c8b3b..c50fb8e 100644 --- a/bin/tests/lib.php +++ b/bin/tests/lib.php @@ -13,7 +13,6 @@ * A check returns true (pass), or a string explaining the failure. There is no * skip: a check that cannot fail is the defect this suite exists to prevent. */ - final class Results { public static int $passed = 0; @@ -35,7 +34,7 @@ function test(string $name, callable $fn): void { try { $result = $fn(); - } catch (\Throwable $e) { + } catch (Throwable $e) { echo " \033[31m✗\033[0m {$name} — {$e->getMessage()}\n"; Results::$failed++; @@ -99,7 +98,7 @@ function phpRun(string $code): array if (! is_resource($process)) { unlink($file); - throw new \RuntimeException('could not start a PHP process'); + throw new RuntimeException('could not start a PHP process'); } $out = stream_get_contents($pipes[1]) ?: ''; From 897b0252ae9926db4350e28de55fa6909ba4fcb2 Mon Sep 17 00:00:00 2001 From: Olivier Gorzalka Date: Wed, 28 Oct 2026 09:01:51 +0100 Subject: [PATCH 3/3] ci: pin the harness workflow on v0.1.11 --- .github/workflows/harness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/harness.yml b/.github/workflows/harness.yml index b2785f3..5341df9 100644 --- a/.github/workflows/harness.yml +++ b/.github/workflows/harness.yml @@ -10,7 +10,7 @@ permissions: {} jobs: harness: - uses: Pollora/harness/.github/workflows/template.yml@feat/template-placeholders-observed + uses: Pollora/harness/.github/workflows/template.yml@v0.1.11 with: mode: enforce permissions: