Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
/phpcs.xml export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/tests/ export-ignore
/phpstan/ export-ignore
/stubs/ export-ignore
/tests/ export-ignore
26 changes: 21 additions & 5 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ permissions:

jobs:
code-quality:
name: Run Code Quality Checks
name: Run Code Quality Checks (PHP ${{ matrix.php }}, Deployer ${{ matrix.deployer }})
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write # needed for cs2pr to post inline annotations
strategy:
matrix:
php: [ '8.2', '8.3', '8.4', '8.5' ]
include:
- { php: '8.2', deployer: '7.3' }
- { php: '8.2', deployer: '7.4' }
- { php: '8.2', deployer: '7.5' }
- { php: '8.3', deployer: '7.3' }
- { php: '8.3', deployer: '7.4' }
- { php: '8.3', deployer: '7.5' }
- { php: '8.3', deployer: '8.0' }
- { php: '8.4', deployer: '8.0' }
- { php: '8.5', deployer: '8.0' }
fail-fast: false

steps:
Expand All @@ -43,15 +52,22 @@ jobs:
- name: Validate composer.json
run: composer validate --strict

- name: Audit Composer packages
run: composer audit --locked
- name: Set Deployer version constraint
env:
DEPLOYER_VERSION: ${{ matrix.deployer }}
run: composer require --no-update deployer/deployer:"${DEPLOYER_VERSION}.*"

# Install dependencies with caching
# Install dependencies with caching — uses `composer update` (highest) so the pinned
# deployer constraint above is actually resolved.
- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
with:
dependency-versions: highest
composer-options: '--prefer-dist --no-progress'

- name: Audit Composer packages
run: composer audit

- name: Run PHP syntax linting
run: composer run-script lint

Expand Down
32 changes: 21 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
php: [ '8.2', '8.3', '8.4', '8.5' ]
# TODO: Add 8.0 when released.
deployer: [ '7.3', '7.4', '7.5' ]
include:
- { php: '8.2', deployer: '7.3' }
- { php: '8.2', deployer: '7.4' }
- { php: '8.2', deployer: '7.5' }
- { php: '8.3', deployer: '7.3' }
- { php: '8.3', deployer: '7.4' }
- { php: '8.3', deployer: '7.5' }
- { php: '8.3', deployer: '8.0' }
- { php: '8.4', deployer: '8.0' }
- { php: '8.5', deployer: '8.0' }
fail-fast: false
name: Tests for Deployer ${{ matrix.deployer }} on PHP ${{ matrix.php }}

Expand All @@ -37,19 +44,22 @@ jobs:
php-version: ${{ matrix.php }}
tools: composer:v2

# Install dependencies with caching
# Pin the Deployer version constraint before installing, so the install
# step resolves the right version (and fails fast on invalid combos like
# PHP 8.2 + Deployer 8 which requires PHP ^8.3).
- name: Set Deployer version constraint
env:
DEPLOYER_VERSION: ${{ matrix.deployer }}
run: composer require --no-update deployer/deployer:"${DEPLOYER_VERSION}.*"

# Install dependencies with caching — uses `composer update` (highest)
# so the pinned deployer constraint above is actually resolved.
- name: Install Composer dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0
with:
dependency-versions: highest
composer-options: '--prefer-dist --no-progress'

# Install specific Deployer version
- name: Install Deployer version
# Install latest patch of the specified version.
env:
DEPLOYER_VERSION: ${{ matrix.deployer }}
run: composer require --no-update deployer/deployer:"${DEPLOYER_VERSION}.*"

# Run PHPStan so we check compatibility with the specified Deployer version.
- name: Run PHPStan
run: composer run-script phpstan
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@ follows PSR-2 and Deployer best practices.

The library includes a comprehensive test suite with unit, integration, and functional tests.

- Run `composer phpunit` to execute all tests.
- Run `composer precommit` before submitting a PR — it runs lint, code style, PHPStan, and all tests.
- Functional tests use a mocked environment to verify rsync commands and file operations without real remote
connections.

The library supports both Deployer v7 and v8. Test against both before submitting (note: Deployer v7 requires PHP 8.2 or 8.3 — it is incompatible with PHP 8.4+):

```bash
# Switch to Deployer v7
composer require --no-update deployer/deployer:"7.5.*"
composer update deployer/deployer --with-dependencies
composer precommit

# Switch back to v8
composer require --no-update deployer/deployer:"^7.3 || ^8.0"
composer update deployer/deployer --with-dependencies
composer precommit
```
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^10.5",
"squizlabs/php_codesniffer": "^3.11 || ^4.0",
"symfony/console": "^6.4",
"symfony/process": "^6.4"
"symfony/console": "^6.4 || ^7.4.0 || ^8.0.0",
"symfony/process": "^6.4 || ^7.4.0 || ^8.0.0"
},
"require": {
"php": "^8.2",
"deployer/deployer": "^7.3"
"composer-runtime-api": "^2.0",
"deployer/deployer": "^7.3 || ^8.0"
},
"autoload": {
"psr-4": {
Expand All @@ -29,6 +30,7 @@
"autoload-dev": {
"psr-4": {
"Gaambo\\DeployerWordpress\\Tests\\": "tests/",
"Gaambo\\DeployerWordpress\\PHPStan\\": "phpstan/",
"Deployer\\": "vendor/deployer/deployer/src/"
}
},
Expand Down
Loading