@@ -16,8 +16,85 @@ concurrency:
16
16
cancel-in-progress : true
17
17
18
18
jobs :
19
- # ### TEST STAGE ####
20
- test :
19
+ # Run CI checks/tests which have no dependency on the PHPCS version used.
20
+ test-php :
21
+ runs-on : ubuntu-latest
22
+
23
+ strategy :
24
+ matrix :
25
+ php : ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
26
+
27
+ name : " Test + Lint: PHP ${{ matrix.php }}"
28
+
29
+ continue-on-error : ${{ matrix.php == '8.5' }}
30
+
31
+ steps :
32
+ - name : Checkout code
33
+ uses : actions/checkout@v4
34
+
35
+ # Updating the lists can fail intermittently, typically after Microsoft has released a new package.
36
+ # This should not be blocking for this job, so ignore any errors from this step.
37
+ # Ref: https://github.com/dotnet/core/issues/4167
38
+ - name : Update the available packages list
39
+ continue-on-error : true
40
+ run : sudo apt-get update
41
+
42
+ - name : Install xmllint
43
+ run : sudo apt-get install --no-install-recommends -y libxml2-utils
44
+
45
+ - name : Install PHP
46
+ uses : shivammathur/setup-php@v2
47
+ with :
48
+ php-version : ${{ matrix.php }}
49
+ ini-values : error_reporting=-1, display_errors=On
50
+ coverage : none
51
+ tools : cs2pr
52
+
53
+ # Install dependencies and handle caching in one go.
54
+ # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
55
+ - name : Install Composer dependencies
56
+ uses : " ramsey/composer-install@v3"
57
+ with :
58
+ composer-options : ${{ matrix.php == '8.5' && '--ignore-platform-req=php+' || '' }}
59
+ # Bust the cache at least once a month - output format: YYYY-MM.
60
+ custom-cache-suffix : $(date -u "+%Y-%m")
61
+
62
+ - name : Lint against parse errors (PHP 7.2+)
63
+ if : ${{ matrix.php >= '7.2' }}
64
+ run : composer lint -- --checkstyle | cs2pr
65
+
66
+ - name : Lint against parse errors (PHP < 7.2)
67
+ if : ${{ matrix.php < '7.2' }}
68
+ run : composer lintlt72 -- --checkstyle | cs2pr
69
+
70
+ # Check that any sniffs available are feature complete.
71
+ # This also acts as an integration test for the feature completeness script,
72
+ # which is why it is run against various PHP versions and not in the "Sniff" stage.
73
+ - name : Check for feature completeness
74
+ run : composer check-complete
75
+
76
+ - name : Grab PHPUnit version
77
+ id : phpunit_version
78
+ # yamllint disable rule:line-length
79
+ run : echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> "$GITHUB_OUTPUT"
80
+ # yamllint enable rule:line-length
81
+
82
+ - name : Determine PHPUnit composer script to use
83
+ id : phpunit_script
84
+ run : |
85
+ if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then
86
+ echo 'SUFFIX=' >> "$GITHUB_OUTPUT"
87
+ elif [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
88
+ echo 'SUFFIX=' >> "$GITHUB_OUTPUT"
89
+ else
90
+ echo 'SUFFIX=-lte9' >> "$GITHUB_OUTPUT"
91
+ fi
92
+
93
+ - name : Run the unit tests for the DevTools
94
+ run : composer test-tools${{ steps.phpunit_script.outputs.SUFFIX }}
95
+
96
+ # Run CI checks/tests which have a dependency on the PHPCS version used.
97
+ test-phpcs :
21
98
runs-on : ubuntu-latest
22
99
23
100
strategy :
@@ -38,40 +115,40 @@ jobs:
38
115
39
116
include :
40
117
# Complete the matrix, while preventing issues with PHPCS versions incompatible with certain PHP versions.
41
- - php : ' 8.4 '
118
+ - php : ' 7.3 '
42
119
phpcs_version : ' dev-master'
43
- - php : ' 8.4 '
44
- phpcs_version : ' 3.8.0 '
120
+ - php : ' 7.3 '
121
+ phpcs_version : ' 3.3.1 '
45
122
46
- - php : ' 8.3 '
123
+ - php : ' 7.4 '
47
124
phpcs_version : ' dev-master'
48
- - php : ' 8.3 '
49
- phpcs_version : ' 3.8 .0'
125
+ - php : ' 7.4 '
126
+ phpcs_version : ' 3.5 .0'
50
127
51
- - php : ' 8.2 '
128
+ - php : ' 8.0 '
52
129
phpcs_version : ' dev-master'
53
- - php : ' 8.2 '
54
- phpcs_version : ' 3.6.1 '
130
+ - php : ' 8.0 '
131
+ phpcs_version : ' 3.5.7 '
55
132
56
133
- php : ' 8.1'
57
134
phpcs_version : ' dev-master'
58
135
- php : ' 8.1'
59
136
phpcs_version : ' 3.6.1'
60
137
61
- - php : ' 8.0 '
138
+ - php : ' 8.2 '
62
139
phpcs_version : ' dev-master'
63
- - php : ' 8.0 '
64
- phpcs_version : ' 3.5.7 '
140
+ - php : ' 8.2 '
141
+ phpcs_version : ' 3.6.1 '
65
142
66
- - php : ' 7.4 '
143
+ - php : ' 8.3 '
67
144
phpcs_version : ' dev-master'
68
- - php : ' 7.4 '
69
- phpcs_version : ' 3.5 .0'
145
+ - php : ' 8.3 '
146
+ phpcs_version : ' 3.8 .0'
70
147
71
- - php : ' 7.3 '
148
+ - php : ' 8.4 '
72
149
phpcs_version : ' dev-master'
73
- - php : ' 7.3 '
74
- phpcs_version : ' 3.3.1 '
150
+ - php : ' 8.4 '
151
+ phpcs_version : ' 3.8.0 '
75
152
76
153
# Experimental builds. These are allowed to fail.
77
154
- php : ' 7.4'
@@ -80,24 +157,14 @@ jobs:
80
157
- php : ' 8.5' # Nightly.
81
158
phpcs_version : ' dev-master'
82
159
83
- name : " Test${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }} : PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
160
+ name : " Test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
84
161
85
162
continue-on-error : ${{ matrix.php == '8.5' || matrix.phpcs_version == '4.0.x-dev' }}
86
163
87
164
steps :
88
165
- name : Checkout code
89
166
uses : actions/checkout@v4
90
167
91
- # Updating the lists can fail intermittently, typically after Microsoft has released a new package.
92
- # This should not be blocking for this job, so ignore any errors from this step.
93
- # Ref: https://github.com/dotnet/core/issues/4167
94
- - name : Update the available packages list
95
- continue-on-error : true
96
- run : sudo apt-get update
97
-
98
- - name : Install xmllint
99
- run : sudo apt-get install --no-install-recommends -y libxml2-utils
100
-
101
168
- name : Setup ini config
102
169
id : set_ini
103
170
run : |
@@ -126,36 +193,13 @@ jobs:
126
193
127
194
# Install dependencies and handle caching in one go.
128
195
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
129
- - name : Install Composer dependencies - normal
130
- if : ${{ matrix.php < 8.5 }}
196
+ - name : Install Composer dependencies
131
197
uses : " ramsey/composer-install@v3"
132
198
with :
199
+ composer-options : ${{ matrix.php == '8.5' && '--ignore-platform-req=php+' || '' }}
133
200
# Bust the cache at least once a month - output format: YYYY-MM.
134
201
custom-cache-suffix : $(date -u "+%Y-%m")
135
202
136
- # For PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow installation.
137
- - name : Install Composer dependencies - with ignore platform
138
- if : ${{ matrix.php >= 8.5 }}
139
- uses : " ramsey/composer-install@v3"
140
- with :
141
- composer-options : --ignore-platform-reqs
142
- custom-cache-suffix : $(date -u "+%Y-%m")
143
-
144
- - name : Lint against parse errors (PHP 7.2+)
145
- if : ${{ matrix.phpcs_version == 'dev-master' && matrix.php >= '7.2' }}
146
- run : composer lint -- --checkstyle | cs2pr
147
-
148
- - name : Lint against parse errors (PHP < 7.2)
149
- if : ${{ matrix.phpcs_version == 'dev-master' && matrix.php < '7.2' }}
150
- run : composer lintlt72 -- --checkstyle | cs2pr
151
-
152
- # Check that any sniffs available are feature complete.
153
- # This also acts as an integration test for the feature completeness script,
154
- # which is why it is run against various PHP versions and not in the "Sniff" stage.
155
- - name : Check for feature completeness
156
- if : matrix.phpcs_version == 'dev-master'
157
- run : composer check-complete
158
-
159
203
- name : Grab PHPUnit version
160
204
id : phpunit_version
161
205
# yamllint disable rule:line-length
@@ -175,7 +219,3 @@ jobs:
175
219
176
220
- name : Run the unit tests for the PHPCSDebug sniff
177
221
run : composer test-sniff${{ steps.phpunit_script.outputs.SUFFIX }}
178
-
179
- - name : Run the unit tests for the DevTools
180
- if : ${{ matrix.phpcs_version == 'dev-master' }}
181
- run : composer test-tools${{ steps.phpunit_script.outputs.SUFFIX }}
0 commit comments