Skip to content

Commit 26df70a

Browse files
committed
Setup unit tests PHP matrix
1 parent 2d897b0 commit 26df70a

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

.github/workflows/unit-tests.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ concurrency:
1515

1616
jobs:
1717
unit-php:
18-
name: PHP
18+
name: Unit tests on PHP ${{ matrix.php }}
1919
runs-on: ubuntu-latest
20+
timeout-minutes: 10
21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
25+
26+
env:
27+
WP_ENV_PHP_VERSION: ${{ matrix.php }}
2028

2129
steps:
2230
- name: Checkout project
@@ -31,13 +39,19 @@ jobs:
3139
- name: Setup PHP
3240
uses: shivammathur/setup-php@v2
3341
with:
34-
php-version: 7.2
42+
php-version: '${{ matrix.php }}'
3543
extensions: mbstring, intl
3644

37-
- name: Install composer dependencies
45+
# Ensure that Composer installs the correct versions of packages.
46+
- name: Override PHP version in composer.json
3847
run: |
39-
composer validate
40-
composer install
48+
composer config platform.php '${{ matrix.php }}.99'
49+
composer require "composer/installers:^2.0" --no-update
50+
51+
- name: Install composer dependencies
52+
uses: ramsey/composer-install@v2
53+
with:
54+
dependency-versions: 'highest'
4155

4256
- name: Npm install and build
4357
run: |

0 commit comments

Comments
 (0)