@@ -62,41 +62,47 @@ jobs:
62
62
strategy :
63
63
# Keys:
64
64
# - 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.
66
66
# IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version.
67
67
# - PHPCS will run without errors on PHP 5.4 - 7.4 on any supported version.
68
68
# - PHP 8.0 needs PHPCS 3.5.7+ to run without errors, and we require a higher minimum version.
69
69
# - 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.
73
70
matrix :
74
71
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']
77
73
78
74
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.
79
86
- php : ' 8.3'
80
- phpcs_version : ' dev-master'
81
- wpcs_version : ' 3.0.*'
87
+ dependencies : ' dev'
82
88
83
- name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }} - WPCS ${{ matrix.wpcs_version }}"
89
+ name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.dependencies }}"
84
90
85
91
continue-on-error : ${{ matrix.php == '8.3' }}
86
92
87
93
steps :
88
94
- name : Checkout code
89
95
uses : actions/checkout@v3
90
96
91
- # On stable PHPCS versions , allow for PHP deprecation notices.
97
+ # With stable PHPCS dependencies , allow for PHP deprecation notices.
92
98
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
93
99
- name : Setup ini config
94
100
id : set_ini
95
101
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
98
104
else
99
- echo 'PHP_INI=error_reporting=-1' >> $GITHUB_OUTPUT
105
+ echo 'PHP_INI=error_reporting=-1, display_errors=On ' >> $GITHUB_OUTPUT
100
106
fi
101
107
102
108
- name : Install PHP
@@ -106,11 +112,15 @@ jobs:
106
112
ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
107
113
coverage : none
108
114
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"
114
124
115
125
# Install dependencies and handle caching in one go.
116
126
# @link https://github.com/marketplace/actions/install-composer-dependencies
@@ -130,6 +140,26 @@ jobs:
130
140
composer-options : --ignore-platform-req=php+
131
141
custom-cache-suffix : $(date -u "+%Y-%m")
132
142
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
+
133
163
- name : Run the unit tests
134
164
run : ./bin/unit-tests
135
165
0 commit comments