Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 91 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ jobs:

strategy:
matrix:
php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php:
# PHP 5.3 is tested in coverage section
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
# PHP 8.1 is tested in coverage section
experimental: [false]

include:
Expand All @@ -28,6 +39,48 @@ jobs:
name: "Test on PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: 'zend.assertions=1, error_reporting=-1, display_errors=On'
coverage: none
tools: cs2pr

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ matrix.experimental == false }}
uses: "ramsey/composer-install@v2"

# For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.experimental == true }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs

- name: Lint
run: composer phplint -- --checkstyle | cs2pr

- name: Run unit tests
run: composer phpunit

coverage:
needs: test
# Don't run on forks.
if: github.repository_owner == 'php-parallel-lint' && needs.test.result == 'success'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php: 5.3
- php: 8.1
name: "Coverage on PHP ${{ matrix.php }}"
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -48,29 +101,53 @@ jobs:
with:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
coverage: none
coverage: xdebug
tools: cs2pr

# Remove the PHPCS standard as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3.
- name: 'Composer: remove PHPCS'
if: ${{ matrix.php < 5.4 }}
run: composer remove --dev php-parallel-lint/php-code-style --no-update --no-interaction

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ matrix.experimental == false }}
uses: "ramsey/composer-install@v2"

# For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.experimental == true }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs

- name: Lint
run: composer phplint -- --checkstyle | cs2pr

- name: Run unit tests
run: composer phpunit
- name: Run the unit tests with code coverage
run: composer coverage

# Uploading the results with PHP Coveralls v1 won't work from GH Actions, so switch the PHP version.
- name: Switch to PHP 8.1
if: ${{ success() && matrix.php != '8.1' }}
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none

# Global installing is used for compatibility with composer.lock in PHP 5.3
- name: Install Coveralls
if: ${{ success() }}
run: composer global require php-coveralls/php-coveralls:"^2.4.2" --no-interaction

- name: Upload coverage results to Coveralls
if: ${{ success() }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}
run: php-coveralls -v -x build/logs/clover.xml


coveralls-finish:
needs: coverage
# Don't run on forks.
if: github.repository_owner == 'php-parallel-lint' && needs.coverage.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ echo $highlighter->getWholeFile($fileContent);
[![CS](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/cs.yml/badge.svg)](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/cs.yml)
[![Test](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/test.yml/badge.svg)](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/test.yml)
[![License](https://poser.pugx.org/php-parallel-lint/php-console-highlighter/license.svg)](https://packagist.org/packages/php-parallel-lint/php-console-highlighter)
[![Coverage Status](https://coveralls.io/repos/github/php-parallel-lint/PHP-Console-Highlighter/badge.svg?branch=master)](https://coveralls.io/github/php-parallel-lint/PHP-Console-Highlighter?branch=master)