Skip to content

Merge pull request #70 from spawnia/support-phpunit-10 #374

Merge pull request #70 from spawnia/support-phpunit-10

Merge pull request #70 from spawnia/support-phpunit-10 #374

Workflow file for this run

name: Unit Tests
on:
push:
branches:
- master
pull_request:
branches:
- "*"
# 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-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COMPOSER_NO_INTERACTION: 1
strategy:
matrix:
php: ['8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4']
dependency-version: ['prefer-stable']
experimental: [false]
include:
- php: '7.2'
dependency-version: 'prefer-lowest'
experimental: false
- php: '7.3'
dependency-version: 'prefer-lowest'
experimental: false
- php: '7.4'
dependency-version: 'prefer-lowest'
experimental: false
- php: '8.0'
dependency-version: 'prefer-lowest'
experimental: false
- php: '8.1'
dependency-version: 'prefer-lowest'
experimental: false
- php: '8.2'
dependency-version: 'prefer-lowest'
experimental: false
- php: '8.3'
dependency-version: 'prefer-stable'
experimental: true
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
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: error_reporting=E_ALL, display_errors=On
coverage: none
tools: composer
# Remove the coding standards package as it has a higher minimum PHP
# requirement and would prevent running the tests on older PHP versions.
- name: 'Composer: remove CS dependency'
run: composer remove --dev --no-update dms/coding-standard --no-interaction
- name: 'Composer: update PHPUnit for testing lowest (PHP 7.2)'
if: ${{ matrix.dependency-version == 'prefer-lowest' && matrix.php == '7.2' }}
run: composer require --no-update phpunit/phpunit:"^8.0" --no-interaction
- name: 'Composer: update PHPUnit for testing lowest (PHP 7.3+)'
if: ${{ matrix.dependency-version == 'prefer-lowest' && matrix.php != '7.2' }}
run: composer require --no-update phpunit/phpunit:"^9.0" --no-interaction
- name: Install dependencies - normal
if: ${{ matrix.php < 8.3 }}
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction
- name: Install dependencies - ignore platform reqs
if: ${{ matrix.php >= 8.3 }}
run: |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --ignore-platform-req=php+ --no-interaction
- name: Migrate PHPUnit configuration if possible
run: vendor/bin/phpunit --migrate-configuration || echo '--migrate-configuration not available'
- name: Execute Unit Tests
run: vendor/bin/phpunit