1313 workflow_dispatch :
1414
1515jobs :
16+ build :
17+ runs-on : ubuntu-latest
18+
19+ strategy :
20+ matrix :
21+ php : ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
22+
23+ name : " Build Phar on PHP: ${{ matrix.php }}"
24+
25+ continue-on-error : ${{ matrix.php == '8.2' }}
26+
27+ steps :
28+ - name : Checkout code
29+ uses : actions/checkout@v2
30+
31+ - name : Setup PHP
32+ uses : shivammathur/setup-php@v2
33+ with :
34+ php-version : ${{ matrix.php }}
35+ coverage : none
36+ ini-values : phar.readonly=Off, error_reporting=-1, display_errors=On
37+
38+ - name : Build the phar
39+ run : php scripts/build-phar.php
40+
41+ - name : Upload the PHPCS phar
42+ uses : actions/upload-artifact@v2
43+ if : ${{ success() && matrix.php == '8.0' }}
44+ with :
45+ name : phpcs-phar
46+ path : ./phpcs.phar
47+ if-no-files-found : error
48+ retention-days : 28
49+
50+ - name : Upload the PHPCBF phar
51+ uses : actions/upload-artifact@v2
52+ if : ${{ success() && matrix.php == '8.0' }}
53+ with :
54+ name : phpcbf-phar
55+ path : ./phpcbf.phar
56+ if-no-files-found : error
57+ retention-days : 28
58+
59+ # Both the below only check a few files which are rarely changed and therefore unlikely to have issues.
60+ # This test is about testing that the phars are functional, *not* about whether the code style complies.
61+ - name : ' PHPCS: check code style using the Phar file to test the Phar is functional'
62+ run : php phpcs.phar ./scripts
63+
64+ - name : ' PHPCBF: fix code style using the Phar file to test the Phar is functional'
65+ run : php phpcbf.phar ./scripts
66+
1667 test :
1768 runs-on : ubuntu-latest
69+ needs : build
1870
1971 strategy :
2072 # Keys:
2173 # - custom_ini: Whether to run with specific custom ini settings to hit very specific
2274 # code conditions.
23- # - experimental: Whether the build is "allowed to fail".
2475 matrix :
25- php : ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
76+ php : ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
2677 custom_ini : [false]
27- experimental : [false]
2878
2979 include :
3080 # Builds running the basic tests with different PHP ini settings.
3181 - php : ' 5.5'
3282 custom_ini : true
33- experimental : false
3483 - php : ' 7.0'
3584 custom_ini : true
36- experimental : false
37-
38- # Nightly.
39- - php : ' 8.1'
40- custom_ini : false
41- experimental : true
4285
4386 name : " PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"
4487
45- continue-on-error : ${{ matrix.experimental }}
88+ continue-on-error : ${{ matrix.php == '8.2' }}
4689
4790 steps :
4891 - name : Checkout code
@@ -54,11 +97,11 @@ jobs:
5497 # Set the "short_open_tag" ini to make sure specific conditions are tested.
5598 # Also turn on error_reporting to ensure all notices are shown.
5699 if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '5.5' ]]; then
57- echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=E_ALL , display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On'
100+ echo '::set-output name=PHP_INI::error_reporting=-1 , display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On'
58101 elif [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.0' ]]; then
59- echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=E_ALL , display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On'
102+ echo '::set-output name=PHP_INI::error_reporting=-1 , display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On'
60103 else
61- echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=E_ALL , display_errors=On'
104+ echo '::set-output name=PHP_INI::error_reporting=-1 , display_errors=On'
62105 fi
63106
64107 - name : Install PHP
@@ -72,12 +115,12 @@ jobs:
72115 # Install dependencies and handle caching in one go.
73116 # @link https://github.com/marketplace/actions/install-composer-dependencies
74117 - name : Install Composer dependencies - normal
75- if : ${{ matrix.php < 8.0 }}
118+ if : ${{ matrix.php < ' 8.0' }}
76119 uses : " ramsey/composer-install@v1"
77120
78121 # For PHP 8.0+, we need to install with ignore platform reqs as PHPUnit 7 is still used.
79122 - name : Install Composer dependencies - with ignore platform
80- if : ${{ matrix.php >= 8.0 }}
123+ if : ${{ matrix.php >= ' 8.0' }}
81124 uses : " ramsey/composer-install@v1"
82125 with :
83126 composer-options : --ignore-platform-reqs
@@ -88,37 +131,39 @@ jobs:
88131 run : php bin/phpcs --config-set php_path php
89132
90133 - name : ' PHPUnit: run the tests'
91- if : ${{ matrix.php != 8.1 }}
134+ if : ${{ matrix.php != ' 8.1' && matrix.php != '8.2' }}
92135 run : vendor/bin/phpunit tests/AllTests.php
93136
94137 # We need to ignore the config file so that PHPUnit doesn't try to read it.
95138 # The config file causes an error on PHP 8.1+ with PHPunit 7, but it's not needed here anyway
96139 # as we can pass all required settings in the phpunit command.
97- - name : ' PHPUnit: run the tests on PHP nightly '
98- if : ${{ matrix.php == 8.1 }}
140+ - name : ' PHPUnit: run the tests on PHP > 8.0 '
141+ if : ${{ matrix.php == ' 8.1' || matrix.php == '8.2' }}
99142 run : vendor/bin/phpunit tests/AllTests.php --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests
100143
101144 - name : ' PHPCS: check code style without cache, no parallel'
102- if : ${{ matrix.custom_ini == false && matrix.php != 7.4 }}
145+ if : ${{ matrix.custom_ini == false && matrix.php != ' 7.4' }}
103146 run : php bin/phpcs --no-cache --parallel=1
104147
105148 - name : ' PHPCS: check code style to show results in PR'
106- if : ${{ matrix.custom_ini == false && matrix.php == 7.4 }}
149+ if : ${{ matrix.custom_ini == false && matrix.php == ' 7.4' }}
107150 continue-on-error : true
108151 run : php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml
109152
110153 - name : Show PHPCS results in PR
111- if : ${{ matrix.custom_ini == false && matrix.php == 7.4 }}
154+ if : ${{ matrix.custom_ini == false && matrix.php == ' 7.4' }}
112155 run : cs2pr ./phpcs-report.xml
113156
114157 - name : ' Composer: validate config'
115158 if : ${{ matrix.custom_ini == false }}
116159 run : composer validate --no-check-all --strict
117160
118- - name : Build the phar
119- if : ${{ matrix.custom_ini == false }}
120- run : php scripts/build-phar.php
161+ - name : Download the PHPCS phar
162+ uses : actions/download-artifact@v2
163+ with :
164+ name : phpcs-phar
121165
166+ # This test specifically tests that the Phar which will be released works correctly on all PHP versions.
122167 - name : ' PHPCS: check code style using the Phar file'
123168 if : ${{ matrix.custom_ini == false }}
124169 run : php phpcs.phar
0 commit comments