Skip to content

Commit 89ffb5e

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 5c5260e commit 89ffb5e

File tree

4 files changed

+103
-62
lines changed

4 files changed

+103
-62
lines changed

.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: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
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 ./PHPCompatibilityPasswordCompat/ruleset.xml <(xmllint --format "./PHPCompatibilityPasswordCompat/ruleset.xml")
51+
52+
test:
53+
needs: xmllint
54+
runs-on: ubuntu-latest
55+
56+
strategy:
57+
matrix:
58+
php: ['5.4', 'latest']
59+
phpcompat: ['stable']
60+
experimental: [false]
61+
62+
include:
63+
- php: '7.4'
64+
phpcompat: 'dev-develop as 9.99.99'
65+
experimental: true
66+
67+
name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
68+
continue-on-error: ${{ matrix.experimental }}
69+
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@v2
73+
74+
- name: Install PHP
75+
uses: shivammathur/setup-php@v2
76+
with:
77+
php-version: ${{ matrix.php }}
78+
coverage: none
79+
80+
- name: Conditionally update PHPCompatibility to develop version
81+
if: ${{ matrix.phpcompat != 'stable' }}
82+
run: |
83+
composer config minimum-stability dev
84+
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}"
85+
86+
- name: Install dependencies
87+
run: composer install --no-interaction --no-progress
88+
89+
# Validate the composer.json file.
90+
# @link https://getcomposer.org/doc/03-cli.md#validate
91+
- name: Validate Composer installation
92+
run: composer validate --no-check-all --strict
93+
94+
# Make sure that known polyfills don't trigger any errors.
95+
- name: Test the ruleset
96+
run: |
97+
vendor/bin/phpcs -ps ./Test/PasswordCompatTest.php --standard=PHPCompatibilityPasswordCompat --runtime-set testVersion 5.4-
98+
99+
# Check that the ruleset doesn't throw unnecessary errors for the compat library itself.
100+
- name: Test running against the polyfills
101+
run: |
102+
vendor/bin/phpcs -ps ./vendor/ircmaxell/ --standard=PHPCompatibilityPasswordCompat --runtime-set testVersion 5.4- --ignore=/password-compat/test/*

.travis.yml

Lines changed: 0 additions & 60 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-passwordcompat/v/stable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat)
22
[![Latest Unstable Version](https://poser.pugx.org/phpcompatibility/phpcompatibility-passwordcompat/v/unstable.png)](https://packagist.org/packages/phpcompatibility/phpcompatibility-passwordcompat)
33
[![License](https://poser.pugx.org/phpcompatibility/phpcompatibility-passwordcompat/license.png)](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat/blob/master/LICENSE)
4-
[![Build Status](https://travis-ci.org/PHPCompatibility/PHPCompatibilityPasswordCompat.svg?branch=master)](https://travis-ci.org/PHPCompatibility/PHPCompatibilityPasswordCompat)
4+
[![Build Status](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat/workflows/CI/badge.svg?branch=master)](https://github.com/PHPCompatibility/PHPCompatibilityPasswordCompat/actions)
55

66
# PHPCompatibilityPasswordCompat
77

0 commit comments

Comments
 (0)