-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
4 changed files
with
96 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: CI | ||
|
||
on: | ||
# Run on pushes to `master` and on all pull requests. | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
# Also run this workflow on day 15 of every month as the repo isn't that active. | ||
schedule: | ||
- cron: '0 0 15 * *' | ||
|
||
jobs: | ||
xmllint: | ||
name: 'Check XML' | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
XMLLINT_INDENT: ' ' | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
coverage: none | ||
|
||
# Install dependencies to make sure the PHPCS XSD file is available. | ||
- name: Install dependencies | ||
run: composer install --no-dev --no-interaction --no-progress | ||
|
||
- name: Setup xmllint | ||
run: sudo apt-get install --no-install-recommends -y libxml2-utils | ||
|
||
# Show violations inline in the file diff. | ||
# @link https://github.com/marketplace/actions/xmllint-problem-matcher | ||
- uses: korelstar/xmllint-problem-matcher@v1 | ||
|
||
# Validate the xml file. | ||
# @link http://xmlsoft.org/xmllint.html | ||
- name: Validate against schema | ||
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd PHPCompatibilityWP/ruleset.xml | ||
|
||
# Check the code-style consistency of the xml file. | ||
- name: Check code style | ||
run: diff -B ./PHPCompatibilityWP/ruleset.xml <(xmllint --format "./PHPCompatibilityWP/ruleset.xml") | ||
|
||
test: | ||
needs: xmllint | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: ['5.4', 'latest'] | ||
phpcompat: ['stable'] | ||
experimental: [false] | ||
|
||
include: | ||
- php: '7.4' | ||
phpcompat: 'dev-develop as 9.99.99' | ||
experimental: true | ||
|
||
name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}" | ||
continue-on-error: ${{ matrix.experimental }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
|
||
- name: Conditionally update PHPCompatibility to develop version | ||
if: ${{ matrix.phpcompat != 'stable' }} | ||
run: | | ||
composer config minimum-stability dev | ||
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" | ||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress | ||
|
||
# Validate the composer.json file. | ||
# @link https://getcomposer.org/doc/03-cli.md#validate | ||
- name: Validate Composer installation | ||
run: composer validate --no-check-all --strict | ||
|
||
# Make sure that known polyfills don't trigger any errors. | ||
- name: Test the ruleset | ||
run: vendor/bin/phpcs -ps ./Test/WPTest.php --standard=PHPCompatibilityWP --runtime-set testVersion 5.2- |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters