Skip to content

Commit 698bcde

Browse files
committed
CI: switch to GitHub Actions
This commit: * Adds a GH Actions workflow for the CI checks which were previously run on Travis. * Removes the, now redundant, `.travis.yml` configuration. * Updates the `.gitattributes` file. * Updates the "Build Status" badge in the Readme to use the results from the GH Actions runs. Notes: 1. Builds will run on pushes to `master` and on pull requests. For a small repo like this, running on all _pushes_ seems redundant. 2. The build will automatically be triggered once a month (was previously also done on Travis) to make sure that upstream changes to the polyfills themselves will not go unnoticed if they impact the ruleset. 3. If the XMLLint "stage" fails, the test _stage_ will be skipped. Reasoning: if there is a syntax error in the XML, the tests will fail anyhow. 4. The build against PHPCompatibility `dev-develop` should be allowed to fail, which is why is it marked as `experimental` and why `continue-on-error` checks that value. When updating the "required statuses", that particular build should **not** get a checkmark. That way, all builds will run, but a failure of the build on the `dev- develop` branch will not block merging of PRs.
1 parent 7bc806d commit 698bcde

4 files changed

Lines changed: 129 additions & 88 deletions

File tree

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55
/.gitattributes export-ignore
66
/.gitignore export-ignore
7-
/.travis.yml export-ignore
87
/.github/ export-ignore
98
/Test/ export-ignore
109

.github/workflows/ci.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: CI
2+
3+
on:
4+
# Run on pushes to `master` and on all pull requests.
5+
push:
6+
branches:
7+
- master
8+
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 * *'
12+
13+
jobs:
14+
xmllint:
15+
name: 'Check XML'
16+
runs-on: ubuntu-latest
17+
18+
env:
19+
XMLLINT_INDENT: ' '
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: '7.4'
29+
coverage: none
30+
31+
# Install dependencies to make sure the PHPCS XSD file is available.
32+
- name: Install dependencies
33+
run: composer install --no-dev --no-interaction --no-progress
34+
35+
- name: Setup xmllint
36+
run: sudo apt-get install --no-install-recommends -y libxml2-utils
37+
38+
# Show violations inline in the file diff.
39+
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
40+
- uses: korelstar/xmllint-problem-matcher@v1
41+
42+
# Validate the xml file.
43+
# @link http://xmlsoft.org/xmllint.html
44+
- name: Validate against schema
45+
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
46+
47+
# Check the code-style consistency of the xml file.
48+
- name: Check code style
49+
run: |
50+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP54/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP54/ruleset.xml")
51+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP55/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP55/ruleset.xml")
52+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP56/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP56/ruleset.xml")
53+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP70/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP70/ruleset.xml")
54+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP71/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP71/ruleset.xml")
55+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP72/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP72/ruleset.xml")
56+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP73/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP73/ruleset.xml")
57+
diff -B ./PHPCompatibilitySymfonyPolyfillPHP74/ruleset.xml <(xmllint --format "./PHPCompatibilitySymfonyPolyfillPHP74/ruleset.xml")
58+
59+
test:
60+
needs: xmllint
61+
runs-on: ubuntu-latest
62+
63+
strategy:
64+
matrix:
65+
php: ['5.4', 'latest']
66+
phpcompat: ['stable']
67+
experimental: [false]
68+
69+
include:
70+
- php: '7.4'
71+
phpcompat: 'dev-develop as 9.99.99'
72+
experimental: true
73+
74+
name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
75+
continue-on-error: ${{ matrix.experimental }}
76+
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v2
80+
81+
- name: Install PHP
82+
uses: shivammathur/setup-php@v2
83+
with:
84+
php-version: ${{ matrix.php }}
85+
coverage: none
86+
87+
- name: Conditionally require specific versions of the polyfills
88+
if: ${{ matrix.php == '5.4' }}
89+
run: |
90+
composer require --no-update symfony/polyfill-php72:"1.19" symfony/polyfill-php73:"1.19" symfony/polyfill-php74:"1.19"
91+
92+
- name: Conditionally update PHPCompatibility to develop version
93+
if: ${{ matrix.phpcompat != 'stable' }}
94+
run: |
95+
composer config minimum-stability dev
96+
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}"
97+
98+
- name: Install dependencies
99+
run: composer install --no-interaction --no-progress
100+
101+
# Validate the composer.json file.
102+
# @link https://getcomposer.org/doc/03-cli.md#validate
103+
- name: Validate Composer installation
104+
run: composer validate --no-check-all --strict
105+
106+
# Make sure that known polyfills don't trigger any errors.
107+
- name: Test the rulesets
108+
run: |
109+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP54Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP54 --runtime-set testVersion 5.3-
110+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP55Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP55 --runtime-set testVersion 5.3-
111+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP56Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP56 --runtime-set testVersion 5.3-
112+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP70Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP70 --runtime-set testVersion 5.3-
113+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP71Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP71 --runtime-set testVersion 5.3-
114+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP72Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP72 --runtime-set testVersion 5.3-
115+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP73Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP73 --runtime-set testVersion 5.3-
116+
vendor/bin/phpcs -ps ./Test/SymfonyPolyfillPHP74Test.php --standard=PHPCompatibilitySymfonyPolyfillPHP74 --runtime-set testVersion 5.3-
117+
118+
# Check that the rulesets don't throw unnecessary errors for the compat libraries themselves.
119+
- name: Test running against the polyfills
120+
run: |
121+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php54/ --standard=PHPCompatibilitySymfonyPolyfillPHP54 --runtime-set testVersion 5.3-
122+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php55/ --standard=PHPCompatibilitySymfonyPolyfillPHP55 --runtime-set testVersion 5.3-
123+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php56/ ./vendor/symfony/polyfill-util/ --standard=PHPCompatibilitySymfonyPolyfillPHP56 --runtime-set testVersion 5.3- --ignore=*/polyfill-util/TestListener*
124+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php70/ --standard=PHPCompatibilitySymfonyPolyfillPHP70 --runtime-set testVersion 5.3-
125+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php71/ --standard=PHPCompatibilitySymfonyPolyfillPHP71 --runtime-set testVersion 5.3-
126+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php72/ --standard=PHPCompatibilitySymfonyPolyfillPHP72 --runtime-set testVersion 5.3-
127+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php73/ --standard=PHPCompatibilitySymfonyPolyfillPHP73 --runtime-set testVersion 5.3-
128+
vendor/bin/phpcs -ps ./vendor/symfony/polyfill-php74/ --standard=PHPCompatibilitySymfonyPolyfillPHP74 --runtime-set testVersion 5.3-

.travis.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Latest Stable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-symfony/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)
22
[![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-symfony/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-symfony)
33
[![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-symfony/license.png)](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/blob/master/LICENSE)
4-
[![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibilitySymfony.svg?branch=master)](https://travis-ci.org/PHPCompatibility/PHPCompatibilitySymfony)
4+
[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/workflows/CI/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilitySymfony/actions)
55

66
# PHPCompatibilitySymfony
77

0 commit comments

Comments
 (0)