Skip to content

chore(symfony): support 8.0 #2252

chore(symfony): support 8.0

chore(symfony): support 8.0 #2252

# from doctrine/instantiator:
# https://github.com/doctrine/instantiator/blob/97aa11bb71ad6259a8c5a1161b4de2d6cdcc5501/.github/workflows/continuous-integration.yml
name: CI
on:
pull_request:
branches:
- "*.x"
push:
branches:
- "*.x"
schedule:
- cron: "21 4 * * 5" # “At 04:21 on Friday.”
env:
fail-fast: true
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
test-group:
- core
- fos-rest
- jms-serializer
- hateoas
php-version:
- 8.2
- 8.3
- 8.4
- 8.5
symfony-require:
- "6.4"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
composer-flags:
- ""
include:
- test-group: core
php-version: 8.2
symfony-require: "6.4"
composer-flags: "--prefer-lowest"
exclude:
# Symfony 8.x: Requires: PHP 8.4 or higher
- php-version: 8.2
symfony-require: 8.0
- php-version: 8.3
symfony-require: 8.0
# Test only the lowest and highest PHP versions for each optional dependency test group
- test-group: fos-rest
php-version: 8.3
- test-group: fos-rest
php-version: 8.4
- test-group: jms-serializer
php-version: 8.3
- test-group: jms-serializer
php-version: 8.4
- test-group: hateoas
php-version: 8.3
- test-group: hateoas
php-version: 8.4
# Test only the highest versions for a symfony major for each optional dependency test group
- test-group: fos-rest
symfony-require: "7.2"
- test-group: fos-rest
symfony-require: "7.3"
- test-group: jms-serializer
symfony-require: "7.2"
- test-group: jms-serializer
symfony-require: "7.3"
- test-group: hateoas
symfony-require: "7.2"
- test-group: hateoas
symfony-require: "7.3"
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Install PHP with coverage
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer, flex
coverage: pcov
- name: Setup dependencies
uses: ./.github/workflows/common/composer-install
with:
symfony-version: ${{ matrix.symfony-require }}
composer-flags: ${{ matrix.composer-flags }}
test-group: ${{ matrix.test-group }}
- name: PHPUnit Tests
run: |
if [ "${{ matrix.test-group }}" == "core" ]; then
PHPUNIT_ARGS="--exclude-group fos-rest,jms-serializer,hateoas"
else
PHPUNIT_ARGS="--group ${{ matrix.test-group }}"
fi
vendor/bin/phpunit \
--configuration phpunit.xml.dist \
--log-junit=junit-${{ matrix.php-version }}-${{ matrix.symfony-require }}-${{ matrix.test-group }}.xml \
--coverage-clover=coverage-${{ matrix.php-version }}-${{ matrix.symfony-require }}-${{ matrix.test-group }}.xml \
--coverage-filter=src/ \
$PHPUNIT_ARGS
- uses: actions/upload-artifact@v5
with:
name: phpunit-${{ matrix.php-version }}-${{ matrix.symfony-require }}-${{ matrix.test-group }}${{ matrix.composer-flags }}
path: |
coverage*.xml
junit*.xml
if-no-files-found: error
retention-days: 2
codecov:
name: Codecov
runs-on: ubuntu-22.04
needs: phpunit
timeout-minutes: 5
if: github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Download artifacts
uses: actions/download-artifact@v6
- name: Upload test results to Codecov.io
uses: codecov/test-results-action@v1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload code coverage to Codecov.io
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Install PHP without coverage
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer, flex
coverage: none
- name: Setup dependencies
uses: ./.github/workflows/common/composer-install
with:
symfony-version: "7.2.*"
test-group: all
- name: Run PHP-CS-Fixer
run: vendor/bin/php-cs-fixer check -v --diff
phpstan:
name: PHPStan
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Install PHP without coverage
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer, flex
coverage: none
- name: Setup dependencies
uses: ./.github/workflows/common/composer-install
with:
symfony-version: "7.2.*"
test-group: all
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress --no-interaction