@@ -62,41 +62,47 @@ jobs:
6262 strategy :
6363 # Keys:
6464 # - php: The PHP versions to test against.
65- # - phpcs_version : The PHPCS versions to test against.
65+ # - dependencies : The PHPCS dependencies versions to test against.
6666 # IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version.
6767 # - PHPCS will run without errors on PHP 5.4 - 7.4 on any supported version.
6868 # - PHP 8.0 needs PHPCS 3.5.7+ to run without errors, and we require a higher minimum version.
6969 # - PHP 8.1 needs PHPCS 3.6.1+ to run without errors, but works best with 3.7.1+, and we require at least this minimum version.
70- # - The `wpcs_version` key is added to allow additional test builds when multiple WPCS versions
71- # would be supported. As, at this time, only the latest stable release of WPCS is supported,
72- # no additional versions are included in the array.
7370 matrix :
7471 php : ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
75- phpcs_version : ['3.7.2', 'dev-master']
76- wpcs_version : ['3.0.*']
72+ dependencies : ['lowest', 'stable']
7773
7874 include :
75+ # Test against dev versions of all dependencies with select PHP versions for early detection of issues.
76+ - php : ' 5.4'
77+ dependencies : ' dev'
78+ - php : ' 7.0'
79+ dependencies : ' dev'
80+ - php : ' 7.4'
81+ dependencies : ' dev'
82+ - php : ' 8.2'
83+ dependencies : ' dev'
84+
85+ # Test against upcoming PHP version.
7986 - php : ' 8.3'
80- phpcs_version : ' dev-master'
81- wpcs_version : ' 3.0.*'
87+ dependencies : ' dev'
8288
83- name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - WPCS ${{ matrix.wpcs_version }}"
89+ name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}"
8490
8591 continue-on-error : ${{ matrix.php == '8.3' }}
8692
8793 steps :
8894 - name : Checkout code
8995 uses : actions/checkout@v3
9096
91- # On stable PHPCS versions , allow for PHP deprecation notices.
97+ # With stable PHPCS dependencies , allow for PHP deprecation notices.
9298 # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
9399 - name : Setup ini config
94100 id : set_ini
95101 run : |
96- if [[ "${{ matrix.phpcs_version }}" != "dev-master " ]]; then
97- echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED' >> $GITHUB_OUTPUT
102+ if [[ "${{ matrix.dependencies }}" != "dev" ]]; then
103+ echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On ' >> $GITHUB_OUTPUT
98104 else
99- echo 'PHP_INI=error_reporting=-1' >> $GITHUB_OUTPUT
105+ echo 'PHP_INI=error_reporting=-1, display_errors=On ' >> $GITHUB_OUTPUT
100106 fi
101107
102108 - name : Install PHP
@@ -106,11 +112,15 @@ jobs:
106112 ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
107113 coverage : none
108114
109- - name : ' Composer: set PHPCS version for tests'
110- run : composer require squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-update --no-scripts --no-interaction
111-
112- - name : ' Composer: set WPCS version for tests'
113- run : composer require wp-coding-standards/wpcs:"${{ matrix.wpcs_version }}" --no-update --no-scripts --no-interaction
115+ - name : " Composer: set PHPCS dependencies for tests (dev)"
116+ if : ${{ matrix.dependencies == 'dev' }}
117+ run : >
118+ composer require --no-update --no-scripts --no-interaction
119+ squizlabs/php_codesniffer:"dev-master"
120+ phpcsstandards/phpcsutils:"dev-develop"
121+ phpcsstandards/phpcsextra:"dev-develop"
122+ sirbrillig/phpcs-variable-analysis:"2.x"
123+ wp-coding-standards/wpcs:"dev-develop"
114124
115125 # Install dependencies and handle caching in one go.
116126 # @link https://github.com/marketplace/actions/install-composer-dependencies
@@ -130,6 +140,26 @@ jobs:
130140 composer-options : --ignore-platform-req=php+
131141 custom-cache-suffix : $(date -u "+%Y-%m")
132142
143+ - name : " Composer: downgrade PHPCS dependencies for tests (lowest)"
144+ if : ${{ ! startsWith( matrix.php, '8' ) && matrix.dependencies == 'lowest' }}
145+ run : >
146+ composer update --prefer-lowest --no-scripts --no-interaction
147+ squizlabs/php_codesniffer
148+ phpcsstandards/phpcsutils
149+ phpcsstandards/phpcsextra
150+ sirbrillig/phpcs-variable-analysis
151+ wp-coding-standards/wpcs
152+
153+ - name : " Composer: downgrade PHPCS dependencies for tests (lowest) - with ignore platform"
154+ if : ${{ startsWith( matrix.php, '8' ) && matrix.dependencies == 'lowest' }}
155+ run : >
156+ composer update --prefer-lowest --no-scripts --no-interaction --ignore-platform-req=php+
157+ squizlabs/php_codesniffer
158+ phpcsstandards/phpcsutils
159+ phpcsstandards/phpcsextra
160+ sirbrillig/phpcs-variable-analysis
161+ wp-coding-standards/wpcs
162+
133163 - name : Run the unit tests
134164 run : ./bin/unit-tests
135165
0 commit comments