Skip to content

Commit

Permalink
Merge branch 'feature/ghactions-various-tweaks' of https://github.com…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Sep 29, 2021
2 parents ac912de + 1a2d19f commit f619f0b
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,20 @@ jobs:
# Keys:
# - custom_ini: Whether to run with specific custom ini settings to hit very specific
# code conditions.
# - experimental: Whether the build is "allowed to fail".
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
custom_ini: [false]
experimental: [false]

include:
# Builds running the basic tests with different PHP ini settings.
- php: '5.5'
custom_ini: true
experimental: false
- php: '7.0'
custom_ini: true
experimental: false

# Nightly.
- php: '8.1'
custom_ini: false
experimental: true

name: "PHP: ${{ matrix.php }} ${{ matrix.custom_ini && ' with custom ini settings' || '' }}"

continue-on-error: ${{ matrix.experimental }}
continue-on-error: ${{ matrix.php == '8.1' }}

steps:
- name: Checkout code
Expand All @@ -54,11 +45,11 @@ jobs:
# Set the "short_open_tag" ini to make sure specific conditions are tested.
# Also turn on error_reporting to ensure all notices are shown.
if [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '5.5' ]]; then
echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=E_ALL, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On'
echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On, asp_tags=On'
elif [[ ${{ matrix.custom_ini }} == true && "${{ matrix.php }}" == '7.0' ]]; then
echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=E_ALL, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On'
echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=-1, display_errors=On, date.timezone=Australia/Sydney, short_open_tag=On'
else
echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=E_ALL, display_errors=On'
echo '::set-output name=PHP_INI::phar.readonly=Off, error_reporting=-1, display_errors=On'
fi
- name: Install PHP
Expand All @@ -72,12 +63,12 @@ jobs:
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ matrix.php < 8.0 }}
if: ${{ matrix.php < '8.0' }}
uses: "ramsey/composer-install@v1"

# For PHP 8.0+, we need to install with ignore platform reqs as PHPUnit 7 is still used.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.php >= 8.0 }}
if: ${{ matrix.php >= '8.0' }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs
Expand All @@ -88,27 +79,27 @@ jobs:
run: php bin/phpcs --config-set php_path php

- name: 'PHPUnit: run the tests'
if: ${{ matrix.php != 8.1 }}
if: ${{ matrix.php != '8.1' }}
run: vendor/bin/phpunit tests/AllTests.php

# We need to ignore the config file so that PHPUnit doesn't try to read it.
# The config file causes an error on PHP 8.1+ with PHPunit 7, but it's not needed here anyway
# as we can pass all required settings in the phpunit command.
- name: 'PHPUnit: run the tests on PHP nightly'
if: ${{ matrix.php == 8.1 }}
if: ${{ matrix.php == '8.1' }}
run: vendor/bin/phpunit tests/AllTests.php --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests

- name: 'PHPCS: check code style without cache, no parallel'
if: ${{ matrix.custom_ini == false && matrix.php != 7.4 }}
if: ${{ matrix.custom_ini == false && matrix.php != '7.4' }}
run: php bin/phpcs --no-cache --parallel=1

- name: 'PHPCS: check code style to show results in PR'
if: ${{ matrix.custom_ini == false && matrix.php == 7.4 }}
if: ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
continue-on-error: true
run: php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
if: ${{ matrix.custom_ini == false && matrix.php == 7.4 }}
if: ${{ matrix.custom_ini == false && matrix.php == '7.4' }}
run: cs2pr ./phpcs-report.xml

- name: 'Composer: validate config'
Expand Down

0 comments on commit f619f0b

Please sign in to comment.