@@ -16,8 +16,85 @@ concurrency:
1616 cancel-in-progress : true
1717
1818jobs :
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 :
2198 runs-on : ubuntu-latest
2299
23100 strategy :
@@ -38,40 +115,40 @@ jobs:
38115
39116 include :
40117 # Complete the matrix, while preventing issues with PHPCS versions incompatible with certain PHP versions.
41- - php : ' 8.4 '
118+ - php : ' 7.3 '
42119 phpcs_version : ' dev-master'
43- - php : ' 8.4 '
44- phpcs_version : ' 3.8.0 '
120+ - php : ' 7.3 '
121+ phpcs_version : ' 3.3.1 '
45122
46- - php : ' 8.3 '
123+ - php : ' 7.4 '
47124 phpcs_version : ' dev-master'
48- - php : ' 8.3 '
49- phpcs_version : ' 3.8 .0'
125+ - php : ' 7.4 '
126+ phpcs_version : ' 3.5 .0'
50127
51- - php : ' 8.2 '
128+ - php : ' 8.0 '
52129 phpcs_version : ' dev-master'
53- - php : ' 8.2 '
54- phpcs_version : ' 3.6.1 '
130+ - php : ' 8.0 '
131+ phpcs_version : ' 3.5.7 '
55132
56133 - php : ' 8.1'
57134 phpcs_version : ' dev-master'
58135 - php : ' 8.1'
59136 phpcs_version : ' 3.6.1'
60137
61- - php : ' 8.0 '
138+ - php : ' 8.2 '
62139 phpcs_version : ' dev-master'
63- - php : ' 8.0 '
64- phpcs_version : ' 3.5.7 '
140+ - php : ' 8.2 '
141+ phpcs_version : ' 3.6.1 '
65142
66- - php : ' 7.4 '
143+ - php : ' 8.3 '
67144 phpcs_version : ' dev-master'
68- - php : ' 7.4 '
69- phpcs_version : ' 3.5 .0'
145+ - php : ' 8.3 '
146+ phpcs_version : ' 3.8 .0'
70147
71- - php : ' 7.3 '
148+ - php : ' 8.4 '
72149 phpcs_version : ' dev-master'
73- - php : ' 7.3 '
74- phpcs_version : ' 3.3.1 '
150+ - php : ' 8.4 '
151+ phpcs_version : ' 3.8.0 '
75152
76153 # Experimental builds. These are allowed to fail.
77154 - php : ' 7.4'
@@ -80,24 +157,14 @@ jobs:
80157 - php : ' 8.5' # Nightly.
81158 phpcs_version : ' dev-master'
82159
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 }}"
84161
85162 continue-on-error : ${{ matrix.php == '8.5' || matrix.phpcs_version == '4.0.x-dev' }}
86163
87164 steps :
88165 - name : Checkout code
89166 uses : actions/checkout@v4
90167
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-
101168 - name : Setup ini config
102169 id : set_ini
103170 run : |
@@ -115,7 +182,6 @@ jobs:
115182 php-version : ${{ matrix.php }}
116183 ini-values : ${{ steps.set_ini.outputs.PHP_INI }}
117184 coverage : none
118- tools : cs2pr
119185
120186 - name : ' Composer: adjust dependencies'
121187 run : |
@@ -126,36 +192,13 @@ jobs:
126192
127193 # Install dependencies and handle caching in one go.
128194 # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
129- - name : Install Composer dependencies - normal
130- if : ${{ matrix.php < 8.5 }}
195+ - name : Install Composer dependencies
131196 uses : " ramsey/composer-install@v3"
132197 with :
198+ composer-options : ${{ matrix.php == '8.5' && '--ignore-platform-req=php+' || '' }}
133199 # Bust the cache at least once a month - output format: YYYY-MM.
134200 custom-cache-suffix : $(date -u "+%Y-%m")
135201
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-
159202 - name : Grab PHPUnit version
160203 id : phpunit_version
161204 # yamllint disable rule:line-length
@@ -175,7 +218,3 @@ jobs:
175218
176219 - name : Run the unit tests for the PHPCSDebug sniff
177220 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