CI #81
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
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 * *' | |
# Allow manually triggering the workflow. | |
workflow_dispatch: | |
jobs: | |
xmllint: | |
name: 'Check XML' | |
runs-on: ubuntu-latest | |
env: | |
XMLLINT_INDENT: ' ' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 'latest' | |
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 update | |
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 PHPCompatibilityJoomla/ruleset.xml | |
# Check the code-style consistency of the xml file. | |
- name: Check code style | |
run: diff -B ./PHPCompatibilityJoomla/ruleset.xml <(xmllint --format "./PHPCompatibilityJoomla/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@v3 | |
- name: Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: error_reporting=E_ALL, display_errors=On | |
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 }}" --no-interaction | |
- 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/JoomlaTest.php --standard=PHPCompatibilityJoomla --runtime-set testVersion 5.3- |