Skip to content

#15 Deployer v8 Support#21

Merged
gaambo merged 8 commits into
masterfrom
feature/deployer-v8
Jun 2, 2026
Merged

#15 Deployer v8 Support#21
gaambo merged 8 commits into
masterfrom
feature/deployer-v8

Conversation

@gaambo
Copy link
Copy Markdown
Owner

@gaambo gaambo commented Jun 2, 2026

Add Deployer v8 support

#15

Extends compatibility from deployer/deployer:^7.3 to also support ^8.0, while keeping v7 working.

What changed

Runtime compatibility (src/)

  • Utils::isDeployerVersion() — new helper using Composer\InstalledVersions to check the installed Deployer version at runtime; used wherever behaviour differs between versions
  • Utils::quote() — v7/v8 compat wrapper for shell-argument escaping (Deployer\Support\escape_shell_argument was replaced by Deployer\quote in v8)
  • Localhost::run() — updated to use v8's named parameters for runLocally() (v8 replaced the options array with individual named params); v7 falls through to the no-options call since no callers pass options

Recipes

  • recipes/common.php — replaces direct escape_shell_argument import with Utils::quote()

Static analysis

  • stubs/deployer-v7.php — PHPStan bootstrap stub declaring v7-only symbols (Deployer\Support\escape_shell_argument) so v7 compatibility code paths type-check under v8; excluded from Composer dist via .gitattributes
  • phpstan.neon — registers the stub via bootstrapFiles

Test infrastructure

  • tests/bootstrap.php — guards the manual require of Deployer helper files (v8 autoloads them), and adds class_alias shims for moved classes (ProcessRunner, Ssh\Client) so test files use a single import for both versions
  • FunctionalTestCase.phpProcessRunner constructor changed in v8 from ($pop, $logger) to ($logger); uses Utils::isDeployerVersion to select the right call
  • WpCliIntegrationTest.php — migrated mock assertions from ->with($host, $command, $options) to ->willReturnCallback(...) because v8's ProcessRunner::run() dropped the third $options parameter
  • DatabaseTasksFunctionalTest.php — replaced exact "Task X failed" string assertions with OR regex (/failed|error/i) to cover v7's and v8's different error output formats

Dependencies

  • composer.json: constraint updated to ^7.3 || ^8.0, composer-runtime-api ^2.0 added to require (formalises the InstalledVersions dependency), Symfony dev deps widened to ^6.4 || ^7.4.0 || ^8.0.0

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Composer package changes
Prod Packages Operation Base Target
deployer/deployer Upgraded v7.5.12 v8.0.5
maml/maml New - v3.2.0
psr/container New - 2.0.2
symfony/console New - v7.4.13
symfony/deprecation-contracts New - v3.7.0
symfony/polyfill-ctype New - v1.37.0
symfony/polyfill-intl-grapheme New - v1.38.1
symfony/polyfill-intl-normalizer New - v1.38.0
symfony/polyfill-mbstring New - v1.38.1
symfony/process New - v7.4.13
symfony/service-contracts New - v3.7.0
symfony/string New - v7.4.13
symfony/yaml New - v7.4.13
Dev Packages Operation Base Target
phpstan/phpstan Upgraded 2.1.54 2.2.1
psr/container Removed 2.0.2 -
symfony/console Removed v6.4.36 -
symfony/deprecation-contracts Removed v3.6.0 -
symfony/polyfill-ctype Removed v1.37.0 -
symfony/polyfill-intl-grapheme Removed v1.37.0 -
symfony/polyfill-intl-normalizer Removed v1.37.0 -
symfony/polyfill-mbstring Removed v1.37.0 -
symfony/process Removed v6.4.33 -
symfony/service-contracts Removed v3.6.1 -
symfony/string Removed v6.4.34 -

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds runtime + test-suite compatibility for both Deployer v7 and Deployer v8, updating recipes, helpers, CI matrices, and static analysis so the project can be installed and validated under either major Deployer version.

Changes:

  • Introduces version-aware helpers (Utils::isDeployerVersion(), Utils::quote()) and updates localhost execution wrapper for v8 named-parameter runLocally() usage.
  • Updates tests/bootstrap and functional/integration tests to accommodate moved classes and signature changes between v7 and v8.
  • Expands Composer and CI constraints/matrices to test against both Deployer majors (and relevant PHP/Symfony combinations), plus adds PHPStan bootstrap stubs and an ignore-error extension.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Utils.php Adds runtime Deployer version detection and a v7/v8 shell-quoting wrapper.
src/Localhost.php Adapts runLocally() invocation to v8 named parameters while keeping v7 array-options support.
recipes/common.php Switches recipe quoting to the new Utils::quote() compat helper.
tests/bootstrap.php Conditionally loads Deployer helper files (v8 autoloads them) and adds class aliases for moved/renamed classes.
tests/Functional/FunctionalTestCase.php Uses runtime Deployer version to construct ProcessRunner correctly for v7 vs v8.
tests/Integration/WpCliIntegrationTest.php Updates mock expectations to handle Deployer v8 ProcessRunner::run() signature changes.
tests/Functional/Tasks/DatabaseTasksFunctionalTest.php Relaxes failure output assertions to tolerate v7/v8 wording differences.
stubs/deployer-v7.php Adds PHPStan stubs for cross-version symbol differences (primarily v7-only removals).
phpstan/DeployerVersionCompatExtension.php Suppresses intentional PHPStan signature mismatches for runLocally() across Deployer majors.
phpstan.neon Registers the stub bootstrap and the ignore-error extension; includes phpstan/ in scan paths.
composer.json Broadens Deployer and Symfony constraints; adds composer-runtime-api requirement; adds autoload-dev for PHPStan extension.
composer.lock Updates locked dependencies to Deployer v8 and related dependency graph changes.
.github/workflows/tests.yml Updates matrix to include Deployer v8 and pins Deployer version before dependency resolution.
.github/workflows/code-quality.yml Mirrors the tests matrix for code-quality checks and pins Deployer version before dependency resolution.
.gitattributes Excludes phpstan/ and stubs/ from exported dist artifacts.
README.md Updates contributor guidance to run composer precommit and documents testing against both Deployer majors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Integration/WpCliIntegrationTest.php
Comment thread tests/Integration/WpCliIntegrationTest.php
Comment thread tests/Integration/WpCliIntegrationTest.php
Comment thread tests/Integration/WpCliIntegrationTest.php
Comment thread tests/Integration/WpCliIntegrationTest.php
Comment thread stubs/deployer-v7.php
Comment thread .github/workflows/code-quality.yml
gaambo and others added 2 commits June 2, 2026 20:09
Replaced locked audit with general audit for Composer packages.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gaambo gaambo merged commit 01d9e8e into master Jun 2, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants