Skip to content

Commit 8349536

Browse files
authored
Merge pull request #78 from PHPCompatibility/feature/ghactions-split-workflow
GH Actions: split workflow
2 parents 9259ffd + ec43d1f commit 8349536

File tree

3 files changed

+238
-222
lines changed

3 files changed

+238
-222
lines changed

.github/workflows/ci-cron.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: CI Cronjob
2+
3+
on:
4+
# Run this workflow on day 15 of every month as the repo isn't that active.
5+
schedule:
6+
- cron: '0 0 15 * *'
7+
8+
permissions: {}
9+
10+
jobs:
11+
QA:
12+
# Don't run the cron job on forks.
13+
if: ${{ github.event.repository.fork == false }}
14+
15+
uses: ./.github/workflows/reusable-qa-checks.yml

.github/workflows/ci.yml

Lines changed: 2 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -6,231 +6,11 @@ on:
66
branches:
77
- master
88
pull_request:
9-
# Also run this workflow on day 15 of every month as the repo isn't that active.
10-
schedule:
11-
- cron: '0 0 15 * *'
129
# Allow manually triggering the workflow.
1310
workflow_dispatch:
1411

1512
permissions: {}
1613

1714
jobs:
18-
xmllint:
19-
# Don't run the cron job on forks.
20-
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}
21-
22-
name: 'Check XML'
23-
runs-on: ubuntu-latest
24-
25-
env:
26-
XMLLINT_INDENT: ' '
27-
28-
steps:
29-
- name: Checkout code
30-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31-
with:
32-
persist-credentials: false
33-
34-
- name: Install PHP
35-
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
36-
with:
37-
php-version: 'latest'
38-
coverage: none
39-
40-
# Install dependencies to make sure the PHPCS XSD file is available.
41-
- name: Install dependencies
42-
run: composer install --no-dev --no-interaction --no-progress
43-
44-
- name: Validate Ruleset XML file against schema
45-
uses: phpcsstandards/xmllint-validate@0fd9c4a9046055f621fca4bbdccb8eab1fd59fdc # v1.0.1
46-
with:
47-
pattern: "./*/ruleset.xml"
48-
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"
49-
50-
# Check the code-style consistency of the xml files.
51-
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
52-
- name: Check code style
53-
run: |
54-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP54/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP54/ruleset.xml")
55-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP55/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP55/ruleset.xml")
56-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP56/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP56/ruleset.xml")
57-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP70/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP70/ruleset.xml")
58-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP71/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP71/ruleset.xml")
59-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP72/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP72/ruleset.xml")
60-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP73/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP73/ruleset.xml")
61-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP74/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP74/ruleset.xml")
62-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP80/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP80/ruleset.xml")
63-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP81/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP81/ruleset.xml")
64-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP82/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP82/ruleset.xml")
65-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP83/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP83/ruleset.xml")
66-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP84/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP84/ruleset.xml")
67-
diff -B ./PHPCompatibilitySymfonyPolyfillPHP85/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP85/ruleset.xml")
68-
69-
test:
70-
# Don't run the cron job on forks.
71-
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}
72-
73-
needs: xmllint
74-
runs-on: ubuntu-latest
75-
76-
strategy:
77-
matrix:
78-
# These PHP versions should align with the PHP version drops in Symfony itself.
79-
# - Originally the Symfony polyfills supported PHP >= 5.3.3 (tested via PHP 5.4 as setup-php doesn't install PHP 5.3).
80-
# The polyfills need to be installed at v 1.19 (last before the version drop) to test this.
81-
# - As of version v 1.20, the Symfony polyfills support PHP >= 7.1.
82-
# The polyfills need to be installed at v 1.30 (last before the version drop) to test this.
83-
# - As of version v 1.31, the Symfony polyfills support PHP >= 7.2 (tested via PHP "latest").
84-
# The polyfills should default to the latest release to test this.
85-
php: ['5.4', '7.1', 'latest']
86-
phpcompat: ['stable']
87-
experimental: [false]
88-
89-
include:
90-
- php: '7.4'
91-
phpcompat: 'dev-develop as 10.99.99'
92-
experimental: true
93-
94-
name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
95-
continue-on-error: ${{ matrix.experimental }}
96-
97-
steps:
98-
- name: Checkout code
99-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
100-
with:
101-
persist-credentials: false
102-
103-
- name: Install PHP
104-
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
105-
with:
106-
php-version: ${{ matrix.php }}
107-
ini-values: error_reporting=E_ALL, display_errors=On, display_startup_errors=On
108-
coverage: none
109-
110-
# Remove the PHP 8.x polyfills on PHP < 7 as the minimum requirement is PHP 7.1 and the autoloading
111-
# of the polyfill bootstrap file via Composer would generate a parse error, blocking the DealerDirect plugin
112-
# from setting the installed_paths for PHPCS.
113-
- name: "Conditionally remove some polyfill packages (PHP 5.4)"
114-
if: ${{ matrix.php == '5.4' }}
115-
run: >
116-
composer remove --dev --no-update --no-scripts --no-interaction
117-
symfony/polyfill-php80
118-
symfony/polyfill-php81
119-
symfony/polyfill-php82
120-
symfony/polyfill-php83
121-
symfony/polyfill-php84
122-
symfony/polyfill-php85
123-
124-
- name: "Conditionally require specific versions of the polyfills (PHP 5.4)"
125-
if: ${{ matrix.php == '5.4' }}
126-
run: >
127-
composer require --dev --no-update --no-interaction
128-
symfony/polyfill-php72:"1.19"
129-
symfony/polyfill-php73:"1.19"
130-
symfony/polyfill-php74:"1.19"
131-
132-
# Remove the PHP >= 8.5 polyfills on PHP 7.1 as the minimum requirement is PHP 7.2.
133-
- name: "Conditionally remove some polyfill packages (PHP 7.1)"
134-
if: ${{ matrix.php == '7.1' }}
135-
run: composer remove --dev symfony/polyfill-php85 --no-update --no-scripts --no-interaction
136-
137-
- name: "Conditionally require specific versions of the polyfills (PHP 7.1)"
138-
if: ${{ matrix.php == '7.1' }}
139-
run: >
140-
composer require --dev --no-update --no-interaction
141-
symfony/polyfill-php73:"1.30"
142-
symfony/polyfill-php74:"1.30"
143-
symfony/polyfill-php80:"1.30"
144-
symfony/polyfill-php81:"1.30"
145-
symfony/polyfill-php82:"1.30"
146-
symfony/polyfill-php83:"1.30"
147-
symfony/polyfill-php84:"1.30"
148-
149-
- name: Conditionally update PHPCompatibility to develop version
150-
if: ${{ matrix.phpcompat != 'stable' }}
151-
run: |
152-
composer config minimum-stability dev
153-
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction
154-
155-
- name: Install dependencies
156-
run: composer install --no-interaction --no-progress
157-
158-
# Validate the composer.json file.
159-
# @link https://getcomposer.org/doc/03-cli.md#validate
160-
- name: Validate Composer installation
161-
run: composer validate --no-check-all --strict
162-
163-
# Make sure that known polyfills don't trigger any errors.
164-
- name: Test the rulesets
165-
run: |
166-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP54Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP54 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
167-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP55Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP55 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
168-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP56Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP56 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
169-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP70Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP70 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
170-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP71Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP71 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
171-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP72Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP72 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
172-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP73Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP73 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
173-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP74Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP74 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
174-
175-
- name: Test the PHP 8.0-8.4 rulesets
176-
# The PHP 8.x polyfills have a minimum PHP requirement of PHP 7.1.
177-
if: ${{ matrix.php != '5.4' }}
178-
run: |
179-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP80Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP80 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
180-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP81Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP81 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
181-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP82Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP82 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
182-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP83Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP83 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
183-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP84Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP84 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
184-
185-
- name: Test the PHP 8.5 ruleset
186-
# The PHP 8.5 polyfills have a minimum PHP requirement of PHP 7.2.
187-
if: ${{ matrix.php == 'latest' }}
188-
run: |
189-
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP85Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP85 --runtime-set testVersion 7.2-
190-
191-
# Check that the rulesets don't throw unnecessary errors for the compat libraries themselves.
192-
# Note: the polyfills for PHP 5.4 - 7.1 have been decoupled from the monorepo at version 1.19.
193-
# The polyfills for PHP 7.2 have been decoupled from the monorepo at version 1.30.
194-
# These are no longer updated.
195-
- name: Test running against the polyfills - polyfills 5.4-7.1
196-
run: |
197-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php54/ --standard=PHPCompatibilitySymfonyPolyfillPHP54 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
198-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php55/ --standard=PHPCompatibilitySymfonyPolyfillPHP55 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
199-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php56/ ./vendor/symfony/polyfill-util/ --standard=PHPCompatibilitySymfonyPolyfillPHP56 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3- --ignore=*/polyfill-util/TestListener*
200-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php70/ --standard=PHPCompatibilitySymfonyPolyfillPHP70 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
201-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php71/ --standard=PHPCompatibilitySymfonyPolyfillPHP71 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
202-
203-
# The polyfills for PHP 7.2-7.4 are compatible with PHP 5.3+ at version 1.19.
204-
- name: "Test running against the polyfills - polyfills 7.2- (v1.19)"
205-
if: ${{ matrix.php == '5.4' }}
206-
run: |
207-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php72/ --standard=PHPCompatibilitySymfonyPolyfillPHP72 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
208-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php73/ --standard=PHPCompatibilitySymfonyPolyfillPHP73 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
209-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php74/ --standard=PHPCompatibilitySymfonyPolyfillPHP74 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 5.3-
210-
211-
# The polyfills for PHP 7.2-8.4 are compatible with PHP 7.1+ at version 1.30.
212-
- name: "Test running against the polyfills - polyfills 7.2- (v1.30)"
213-
if: ${{ matrix.php == '7.1' }}
214-
run: |
215-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php72/ --standard=PHPCompatibilitySymfonyPolyfillPHP72 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
216-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php73/ --standard=PHPCompatibilitySymfonyPolyfillPHP73 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
217-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php74/ --standard=PHPCompatibilitySymfonyPolyfillPHP74 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
218-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php80/ --standard=PHPCompatibilitySymfonyPolyfillPHP80 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
219-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php81/ --standard=PHPCompatibilitySymfonyPolyfillPHP81 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
220-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php82/ --standard=PHPCompatibilitySymfonyPolyfillPHP82 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
221-
# The PHP 8.3 polyfills at version 1.30 are not tested against PHP 7.1 as they are not in actual fact
222-
# compatible with PHP 7.1. This was correctly detected by PHPCompatibility and would cause this test to fail.
223-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php84/ --standard=PHPCompatibilitySymfonyPolyfillPHP84 --exclude=PHPCompatibility.Upgrade.LowPHP --runtime-set testVersion 7.1-
224-
225-
# The polyfills for PHP 7.3 and higher are compatible with PHP 7.2+ at the current version.
226-
- name: "Test running against the polyfills - polyfills 7.3- (current)"
227-
if: ${{ matrix.php == 'latest' }}
228-
run: |
229-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php73/ --standard=PHPCompatibilitySymfonyPolyfillPHP73 --runtime-set testVersion 7.2-
230-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php74/ --standard=PHPCompatibilitySymfonyPolyfillPHP74 --runtime-set testVersion 7.2-
231-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php80/ --standard=PHPCompatibilitySymfonyPolyfillPHP80 --runtime-set testVersion 7.2-
232-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php81/ --standard=PHPCompatibilitySymfonyPolyfillPHP81 --runtime-set testVersion 7.2-
233-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php82/ --standard=PHPCompatibilitySymfonyPolyfillPHP82 --runtime-set testVersion 7.2-
234-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php83/ --standard=PHPCompatibilitySymfonyPolyfillPHP83 --runtime-set testVersion 7.2-
235-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php84/ --standard=PHPCompatibilitySymfonyPolyfillPHP84 --runtime-set testVersion 7.2-
236-
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php85/ --standard=PHPCompatibilitySymfonyPolyfillPHP85 --runtime-set testVersion 7.2-
15+
QA:
16+
uses: ./.github/workflows/reusable-qa-checks.yml

0 commit comments

Comments
 (0)