Skip to content

Commit 80679b7

Browse files
authored
Workflow Updates
1 parent f6e349e commit 80679b7

File tree

2 files changed

+41
-7
lines changed

2 files changed

+41
-7
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup PHP
3131
uses: shivammathur/setup-php@v2
3232
with:
33-
php-version: '8.0'
33+
php-version: '7.4'
3434
tools: composer:v2, phpcs
3535

3636
- name: Check for package-lock.json
@@ -56,7 +56,12 @@ jobs:
5656
- name: Install PHP dependencies
5757
run: |
5858
if [ -f composer.json ]; then
59-
composer install --prefer-dist --no-progress
59+
# Configure platform to ensure compatibility
60+
composer config platform.php 7.4
61+
composer install --prefer-dist --no-progress || {
62+
echo "Standard install failed, trying with --ignore-platform-reqs"
63+
composer install --prefer-dist --no-progress --ignore-platform-reqs
64+
}
6065
else
6166
echo "No composer.json found. Skipping composer install."
6267
fi
@@ -120,13 +125,18 @@ jobs:
120125
- name: Setup PHP
121126
uses: shivammathur/setup-php@v2
122127
with:
123-
php-version: '8.0'
128+
php-version: '7.4'
124129
tools: composer:v2
125130

126131
- name: Install dependencies
127132
run: |
128133
if [ -f composer.json ]; then
129-
composer install --no-dev --prefer-dist --no-progress
134+
# Configure platform to ensure compatibility
135+
composer config platform.php 7.4
136+
composer install --no-dev --prefer-dist --no-progress || {
137+
echo "Standard install failed, trying with --ignore-platform-reqs"
138+
composer install --no-dev --prefer-dist --no-progress --ignore-platform-reqs
139+
}
130140
else
131141
echo "No composer.json found. Skipping composer install."
132142
fi

.github/workflows/wordpress-tests.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,24 @@ jobs:
9090
run: |
9191
if [ ! -d "vendor" ]; then
9292
echo "::warning::Composer vendor directory not found. Installing dependencies manually."
93-
composer install --no-progress
93+
# For PHP 8.0+, we need to modify requirements or use ignore-platform-reqs
94+
if [[ "${{ matrix.php }}" == "8.0" || "${{ matrix.php }}" == "8.1" || "${{ matrix.php }}" == "8.2" ]]; then
95+
echo "::notice::Using PHP ${{ matrix.php }}, installing with --ignore-platform-reqs"
96+
composer install --no-progress --ignore-platform-reqs
97+
else
98+
composer install --no-progress
99+
fi
94100
fi
101+
95102
if [ ! -f "vendor/bin/phpunit" ]; then
96103
echo "::warning::PHPUnit not found in vendor/bin. Installing phpunit explicitly."
97-
composer require phpunit/phpunit:^7.5 --dev --no-progress
104+
# For PHP 8.0+, we need a different PHPUnit version
105+
if [[ "${{ matrix.php }}" == "8.0" || "${{ matrix.php }}" == "8.1" || "${{ matrix.php }}" == "8.2" ]]; then
106+
echo "::notice::Using PHP ${{ matrix.php }}, installing PHPUnit 9.x"
107+
composer require --dev phpunit/phpunit:^9.0 --ignore-platform-reqs --no-progress
108+
else
109+
composer require --dev phpunit/phpunit:^7.5 --no-progress
110+
fi
98111
fi
99112
100113
- name: Check Test Environment
@@ -123,7 +136,18 @@ jobs:
123136
if: steps.check-test-env.outputs.test_env_ready == 'true'
124137
run: |
125138
if [ -f "vendor/bin/phpunit" ]; then
126-
vendor/bin/phpunit
139+
# Handle WordPress compatibility with PHPUnit for PHP 8.0+
140+
if [[ "${{ matrix.php }}" == "8.0" || "${{ matrix.php }}" == "8.1" || "${{ matrix.php }}" == "8.2" ]]; then
141+
# Run with WordPress test compatibility parameter for newer PHPUnit versions
142+
echo "::notice::Running tests with PHPUnit 9.x compatibility mode for PHP ${{ matrix.php }}"
143+
vendor/bin/phpunit --no-deprecations || {
144+
echo "::warning::Test failed with --no-deprecations, trying with standard execution"
145+
vendor/bin/phpunit
146+
}
147+
else
148+
# PHP 7.x can use PHPUnit 7.x directly
149+
vendor/bin/phpunit
150+
fi
127151
else
128152
echo "::error::PHPUnit executable not found in vendor/bin directory."
129153
ls -la vendor/bin || echo "vendor/bin directory not found"

0 commit comments

Comments
 (0)