support Symfony 7 #32
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: | |
push: ~ | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Earliest and latest version of each major version | |
php-versions: ['7.2', '7.4', '8.0', '8.3'] | |
prefer: ['prefer-stable', 'prefer-lowest'] | |
symfony-versions: ['^5.4', '^6', '^7'] | |
include: | |
- symfony-versions: '^7' | |
symfony7-required-yaml-version: '^6 || ^7' | |
exclude: | |
# Symfony 7 requires at least PHP 8.2 | |
- php-versions: '7.2' | |
symfony-versions: '^7' | |
- php-versions: '7.4' | |
symfony-versions: '^7' | |
- php-versions: '8.0' | |
symfony-versions: '^7' | |
# Symfony 6 requires PHP 8 | |
- php-versions: '7.2' | |
symfony-versions: '^6' | |
- php-versions: '7.4' | |
symfony-versions: '^6' | |
name: Test PHP ${{ matrix.php-versions }}, Symfony ${{ matrix.symfony-versions }}, ${{ matrix.prefer }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
env: | |
fail-fast: true | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.prefer }}-${{ matrix.symfony-versions }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-${{ matrix.symfony-versions }}- | |
- name: Install dependencies | |
run: | | |
for symfony_package in $(jq -r '.require | keys[]' composer.json | grep '^symfony/'); do | |
composer require --no-update "${symfony_package}:${{ matrix.symfony-versions }}" | |
done | |
if [ -n "${{ matrix.symfony7-required-yaml-version }}" ]; then | |
composer require --dev --no-update "symfony/yaml:${{ matrix.symfony7-required-yaml-version }}" | |
fi | |
composer --prefer-dist --${{ matrix.prefer }} update | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Run PHPUnit | |
run: ./vendor/bin/phpunit |