Skip to content

Commit

Permalink
support SF7 (#18)
Browse files Browse the repository at this point in the history
* SF7

---------

Co-authored-by: Gilles Gauthier <ggauthier@spiriit.com>
  • Loading branch information
gilles-g and gilles-g authored Jan 18, 2024
1 parent 1595e0e commit 425c75d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 76 deletions.
88 changes: 23 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,85 +4,43 @@ on:
pull_request:
push:

env:
fail-fast: true
PHPUNIT_FLAGS: "-v"

jobs:
check-cs:
name: Check Coding Standards
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Composer
uses: php-actions/composer@v6

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --diff --dry-run --allow-risky yes

test:
runs-on: ${{ matrix.os }}
name: PHP v${{ matrix.php }}, Symfony v${{ matrix.symfony }} ${{ matrix.composer_flag }}
continue-on-error: ${{ matrix.can-fail }}
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"
strategy:
matrix:
include:
- { os: ubuntu-latest, php: 7.4, symfony: "4.4.*", composer_flag: "--prefer-lowest"}
- { os: ubuntu-latest, php: 8.2, symfony: "4.4.*", composer_flag: ""}
- { os: ubuntu-latest, php: 7.4, symfony: "5.4.*", composer_flag: "--prefer-lowest"}
- { os: ubuntu-latest, php: 7.4, symfony: "5.4.*", composer_flag: ""}
- { os: ubuntu-latest, php: 8.1, symfony: "5.4.*", composer_flag: "--prefer-lowest"}
- { os: ubuntu-latest, php: 8.2, symfony: "5.4.*", composer_flag: ""}
- { os: ubuntu-latest, php: 8.2, symfony: "6.3.*@dev", composer_flag: ""}
- { os: ubuntu-20.04, php: 7.4, symfony: "5.4.*", composer-flags: "--prefer-stable --prefer-lowest", can-fail: false }
- { os: ubuntu-latest, php: 8.3, symfony: "6.4.*", composer-flags: "--prefer-stable", can-fail: false }
- { os: ubuntu-latest, php: 8.2, symfony: "6.3.*", composer-flags: "--prefer-stable", can-fail: false }
- { os: ubuntu-latest, php: 8.2, symfony: "6.4.*", composer-flags: "--prefer-stable", can-fail: false }
- { os: ubuntu-latest, php: 8.3, symfony: "7.0.*", composer-flags: "--prefer-stable", can-fail: false }

steps:
- uses: actions/checkout@v3
- name: "Installing php"
uses: shivammathur/setup-php@v2
- name: "Checkout"
uses: "actions/checkout@v4"
with:
php-version: ${{ matrix.php }}
extensions: curl,mbstring,xdebug
ini-values: date.timezone="Europe/Paris"
coverage: xdebug
tools: composer
fetch-depth: 2

- name: Show PHP version
run: php -v && composer -V

- name: Download Composer cache dependencies from cache
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v3
- name: "Cache Composer packages"
uses: "actions/cache@v3"
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.os }}-composer-

- name: Set Composer stability
if: matrix.symfony == '6.3.*@dev'
run: composer config minimum-stability dev
path: "~/.composer/cache"
key: "php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('composer.json') }}-flags-${{ matrix.composer-flags }}"
restore-keys: "php-"

- name: Install Symfony ${{ matrix.symfony }}
if: matrix.symfony != '6.3.*@dev'
run: composer require symfony/symfony:${{ matrix.symfony }} --no-update

- name: Fix PSR container compatibility
if: |
matrix.symfony == '5.4.*'
&& endsWith(matrix.composer_flag, 'prefer-lowest')
run: composer require psr/container:^1.1

- name: Silence Symfony deprecation helper for lower deps
if: endsWith(matrix.composer_flag, 'prefer-lowest')
run: echo "SYMFONY_DEPRECATIONS_HELPER=weak" >> $GITHUB_ENV
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
tools: "composer:v2,flex"

- name: Install dependencies
run: composer update --no-interaction ${{ matrix.composer_flag }} --prefer-dist --no-progress
run: composer update ${{ matrix.composer-flags }} --prefer-dist
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"

- name: Run PHPUnit Tests
run: composer test
16 changes: 7 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@
}
],
"require": {
"php": ">=7.4",
"symfony/console": "^4.4|^5.4|^6.0",
"symfony/framework-bundle": "^4.4|^5.4|^6.0",
"symfony/twig-bundle": "^4.4|^5.4|^6.0",
"php": ">=7.2",
"symfony/console": "^4.4|^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^4.4|^5.4|^6.0|^7.0",
"symfony/twig-bundle": "^4.4|^5.4|^6.0|^7.0",
"twig/twig": "^v2.14.0|^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.8|^3.16",
"symfony/phpunit-bridge": "^4.4.49|^5.4|^6.0",
"symfony/yaml": "^4.4|^5.4|^6.0",
"symfony/var-dumper": "^4.4|^5.4|^6.0",
"phpunit/phpunit": "^9.6.6"
"symfony/phpunit-bridge": "^7.0.1",
"symfony/yaml": "^4.4|^5.4|^6.0|^7.0",
"symfony/var-dumper": "^4.4|^5.4|^6.0|^7.0"
},
"autoload": {
"psr-4": { "Lexik\\Bundle\\CronFileGeneratorBundle\\": "" },
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</coverage>

<php>
<env name="SYMFONY_PHPUNIT_VERSION" value="9.6"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=27"/>
<env name="SYMFONY_MAX_PHPUNIT_VERSION" value="9.5"></env>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=27"></env>
</php>

<testsuites>
Expand Down

0 comments on commit 425c75d

Please sign in to comment.