diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index 60e905b..55092d9 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -7,6 +7,12 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: checkcs: name: 'Basic CS and QA checks' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..d2866fd --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,58 @@ +name: Lint + +on: + # Run on all pushes and on all pull requests. + push: + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + #### PHP Code Linting #### + lint: + runs-on: ubuntu-latest + + strategy: + matrix: + php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + + name: "Lint: PHP ${{ matrix.php }}" + + continue-on-error: ${{ matrix.php == '8.2' }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On + coverage: none + + - name: 'Composer: remove PHPUnit (not needed for lint)' + run: composer remove phpunit/phpunit --no-update + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: Install Composer dependencies + uses: "ramsey/composer-install@v1" + + - name: "Lint PHP files against parse errors - PHP < 7.0" + if: ${{ matrix.php < 7.0 }} + run: composer lint-lt70 + + - name: "Lint PHP files against parse errors - PHP 7.x" + if: ${{ startsWith( matrix.php, '7' ) }} + run: composer lint7 + + - name: "Lint PHP files against parse errors - PHP >= 8.0" + if: ${{ matrix.php >= 8.0 }} + run: composer lint-gte80 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c5e4a7..04350fe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,12 @@ on: # Allow manually triggering the workflow. workflow_dispatch: +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: #### TEST STAGE #### test: @@ -71,7 +77,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - ini-values: error_reporting=E_ALL, display_errors=On + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On coverage: none - name: 'Composer: set PHPUnit version for tests' @@ -91,18 +97,6 @@ jobs: with: composer-options: --ignore-platform-reqs - - name: "Lint PHP files against parse errors - PHP < 7.0" - if: ${{ matrix.phpunit == 'auto' && matrix.php < 7.0 }} - run: composer lint-lt70 - - - name: "Lint PHP files against parse errors - PHP 7.x" - if: ${{ matrix.phpunit == 'auto' && startsWith( matrix.php, '7' ) }} - run: composer lint7 - - - name: "Lint PHP files against parse errors - PHP >= 8.0" - if: ${{ matrix.phpunit == 'auto' && matrix.php >= 8.0 }} - run: composer lint-gte80 - - name: Run the unit tests if: ${{ matrix.phpunit != '^10.0' }} run: composer test diff --git a/README.md b/README.md index 83d4b9a..5f098d9 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ PHPUnit Polyfills [![Version](https://poser.pugx.org/yoast/phpunit-polyfills/version)](//packagist.org/packages/yoast/phpunit-polyfills) [![CS Build Status](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/cs.yml/badge.svg)](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/cs.yml) +[![Lint Build Status](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/lint.yml/badge.svg)](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/lint.yml) [![Test Build Status](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/PHPUnit-Polyfills/actions/workflows/test.yml) [![Minimum PHP Version](https://img.shields.io/packagist/php-v/yoast/phpunit-polyfills.svg?maxAge=3600)](https://packagist.org/packages/yoast/phpunit-polyfills) [![License: BSD3](https://poser.pugx.org/yoast/phpunit-polyfills/license)](https://github.com/Yoast/PHPUnit-Polyfills/blob/master/LICENSE)