GH Actions: update for the release of PHP 8.3 #96
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: Test | |
on: | |
pull_request: | |
push: | |
# 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.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: | |
- '5.3' | |
- '5.4' | |
- '5.5' | |
- '5.6' | |
- '7.0' | |
- '7.1' | |
- '7.2' | |
- '7.3' | |
# PHP 7.4 is tested in coverage section | |
- '8.0' | |
- '8.1' | |
- '8.2' | |
- '8.3' | |
experimental: [false] | |
include: | |
- php: '8.4' | |
experimental: true | |
name: "Test on PHP ${{ matrix.php }}" | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- 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 | |
# 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-php-dependencies-with-composer | |
- name: Install Composer dependencies - normal | |
if: ${{ matrix.experimental == false }} | |
uses: "ramsey/composer-install@v2" | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
# 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 | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Lint | |
run: composer phplint -- --checkstyle | cs2pr | |
- name: Run unit tests | |
run: composer phpunit | |
coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | |
coverage: xdebug | |
- name: Install Composer dependencies - normal | |
uses: "ramsey/composer-install@v2" | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Run the unit tests with code coverage | |
run: composer coverage | |
# Global install is used to prevent a conflict with the local composer.lock. | |
- name: Install Coveralls | |
if: ${{ success() }} | |
run: composer global require php-coveralls/php-coveralls:"^2.6.0" --no-interaction | |
- name: Upload coverage results to Coveralls | |
if: ${{ success() }} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: php-coveralls -v -x build/logs/clover.xml |