|
| 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 PHPCompatibilityJoomla/ruleset.xml |
| 46 | + |
| 47 | + # Check the code-style consistency of the xml file. |
| 48 | + - name: Check code style |
| 49 | + run: diff -B ./PHPCompatibilityJoomla/ruleset.xml <(xmllint --format "./PHPCompatibilityJoomla/ruleset.xml") |
| 50 | + |
| 51 | + test: |
| 52 | + needs: xmllint |
| 53 | + runs-on: ubuntu-latest |
| 54 | + |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + php: ['5.4', 'latest'] |
| 58 | + phpcompat: ['stable'] |
| 59 | + experimental: [false] |
| 60 | + |
| 61 | + include: |
| 62 | + - php: '7.4' |
| 63 | + phpcompat: 'dev-develop as 9.99.99' |
| 64 | + experimental: true |
| 65 | + |
| 66 | + name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}" |
| 67 | + continue-on-error: ${{ matrix.experimental }} |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Checkout code |
| 71 | + uses: actions/checkout@v2 |
| 72 | + |
| 73 | + - name: Install PHP |
| 74 | + uses: shivammathur/setup-php@v2 |
| 75 | + with: |
| 76 | + php-version: ${{ matrix.php }} |
| 77 | + coverage: none |
| 78 | + |
| 79 | + - name: Conditionally update PHPCompatibility to develop version |
| 80 | + if: ${{ matrix.phpcompat != 'stable' }} |
| 81 | + run: | |
| 82 | + composer config minimum-stability dev |
| 83 | + composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" |
| 84 | +
|
| 85 | + - name: Install dependencies |
| 86 | + run: composer install --no-interaction --no-progress |
| 87 | + |
| 88 | + # Validate the composer.json file. |
| 89 | + # @link https://getcomposer.org/doc/03-cli.md#validate |
| 90 | + - name: Validate Composer installation |
| 91 | + run: composer validate --no-check-all --strict |
| 92 | + |
| 93 | + # Make sure that known polyfills don't trigger any errors. |
| 94 | + - name: Test the ruleset |
| 95 | + run: vendor/bin/phpcs -ps ./Test/JoomlaTest.php --standard=PHPCompatibilityJoomla --runtime-set testVersion 5.3- |
0 commit comments