Fix: Resolve CI dependency conflicts and PHPCS/PHPUnit errors

This commit is contained in:
2025-04-18 19:07:05 +01:00
parent b7bf97d5b4
commit 643f5c6d41
3 changed files with 20 additions and 17 deletions

View File

@@ -28,15 +28,17 @@ jobs:
- name: Install dependencies
run: |
if [[ "${{ matrix.php-versions }}" == "7.0" ]]; then
# Install base dependencies from lock file
composer install --prefer-dist --no-progress
# Update specific dependencies for higher PHP versions if needed
if [[ "${{ matrix.php-versions }}" == "7.4" || "${{ matrix.php-versions }}" == "8.0" ]]; then
echo "Updating dependencies for PHP ${{ matrix.php-versions }}..."
composer require --dev phpunit/phpunit:"^9.5" 10up/wp_mock:"^1.0" --no-update --no-plugins --no-scripts
elif [[ "${{ matrix.php-versions }}" == "7.0" ]]; then
# Force PHPUnit 6.5 for PHP 7.0
composer require --dev phpunit/phpunit:"^6.5" --update-with-dependencies
elif [[ "${{ matrix.php-versions }}" == "8.0" ]]; then
# Update PHPUnit and WP_Mock for PHP 8.0
composer require --dev phpunit/phpunit:"^9.5" 10up/wp_mock:"^1.0" --no-update
fi
# Update all dependencies based on composer.json/composer.lock and any modifications above
composer update --prefer-dist --no-progress
- name: Run tests
run: ./vendor/bin/phpunit
@@ -57,7 +59,7 @@ jobs:
tools: composer:v2, phpcs
- name: Install dependencies
run: composer update --prefer-dist --no-progress
run: composer install --prefer-dist --no-progress
- name: Run PHPCS
run: ./vendor/bin/phpcs --standard=WordPress ./includes ./admin ./wp-plugin-starter-template.php