Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 35 additions & 110 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,132 +6,57 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.2, 8.3, 8.4, 8.5]
symfony: ["5.4.*", "6.4.*", "6.4wApi", "7.3.*", "7.4.*"]
env:
only_sf_latest: &only_sf_latest ${{ matrix.symfony == '7.4.*' }}
php: ["8.2", "8.5"]
symfony: ["5.4", "6.4", "7.4", "8.0"]
exclude:
- php: "8.2"
symfony: "8.0"

steps:
- name: Checkout code
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: Setup PHP != 8.5
if: ${{ matrix.php != '8.5' }}
uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite
coverage: none
coverage: pcov

- name: Setup PHP 8.5
if: ${{ matrix.php == '8.5' }}
uses: shivammathur/setup-php@v2
- uses: actions/cache@v5
with:
php-version: ${{ matrix.php }}
tools: composer:v2
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite
coverage: none
# this ini directive seems to be off by default in PHP 8.5
# see https://github.com/php/php-src/issues/20279
# enable it because codeception relies on it.
ini-values: register_argc_argv=1

- name: Set Symfony version reference
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
if [[ "$MATRIX_SYMFONY" == *'*' ]]; then
echo "SF_REF=${MATRIX_SYMFONY%.*}" >> "$GITHUB_ENV"
else
echo "SF_REF=$MATRIX_SYMFONY" >> "$GITHUB_ENV"
fi

- name: Set Composer Symfony constraint
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
if [[ "$MATRIX_SYMFONY" == "6.4wApi" ]]; then
echo "COMP_SYMFONY=6.4.*" >> "$GITHUB_ENV"
else
echo "COMP_SYMFONY=$MATRIX_SYMFONY" >> "$GITHUB_ENV"
fi
path: ~/.cache/composer
key: php-${{ matrix.php }}-sf-${{ matrix.symfony }}-${{ hashFiles('**/composer.json') }}
restore-keys: php-${{ matrix.php }}-sf-${{ matrix.symfony }}-

- name: Checkout Symfony ${{ env.SF_REF }} sample
uses: actions/checkout@v4
- uses: actions/checkout@v6
name: Checkout Symfony ${{ matrix.symfony }} app
with:
repository: Codeception/symfony-module-tests
path: framework-tests
ref: ${{ env.SF_REF }}

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

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

- name: Install PHPUnit 10
run: composer require --dev --no-update phpunit/phpunit:^10.0
ref: ${{ matrix.symfony }}

- name: Install dependencies
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
composer require --no-update \
symfony/{finder,yaml,console,event-dispatcher,css-selector,dom-crawler,browser-kit}:${{ env.COMP_SYMFONY }} \
vlucas/phpdotenv \
codeception/module-asserts:"3.*" \
codeception/module-doctrine:"3.*"

if [[ "$MATRIX_SYMFONY" == "6.4wApi" ]]; then
composer require codeception/module-rest="3.*" --no-update
fi

composer update --prefer-dist --no-progress

- name: Run PHPStan (max)
if: *only_sf_latest
run: composer phpstan

- name: Run PHP-CS-Fixer
if: *only_sf_latest
run: composer cs-check

- name: Run Composer Audit
if: *only_sf_latest
run: composer audit

- name: Validate Composer files
run: composer validate --strict
working-directory: framework-tests

- name: Install PHPUnit in framework-tests
run: composer require --dev --no-update phpunit/phpunit:^10.0
working-directory: framework-tests

- name: Prepare Symfony sample
run: |
composer remove codeception/codeception codeception/module-asserts codeception/module-doctrine codeception/lib-innerbrowser codeception/module-symfony --dev --no-update
composer update --no-progress
working-directory: framework-tests
sed -i "s/\^5.4 | \^6.4 | \^7.4 | \^8.0/${{ matrix.symfony }}.*/g" composer.json
composer install --prefer-dist --no-progress

- name: Setup Database
run: |
php bin/console doctrine:schema:update --force
php bin/console doctrine:fixtures:load --quiet
working-directory: framework-tests
- name: Quality checks
if: matrix.symfony == '8.0'
run: composer validate --strict && composer audit && composer cs-check && composer phpstan

- name: Generate JWT keypair
if: ${{ matrix.symfony == '6.4wApi' }}
run: php bin/console lexik:jwt:generate-keypair --skip-if-exists
working-directory: framework-tests
- name: Run module tests
run: vendor/bin/phpunit tests ${{ matrix.symfony == '8.0' && '--coverage-text --coverage-filter src' || '' }}

- name: Run tests
- name: Prepare Symfony app & run tests
run: |
php vendor/bin/codecept build -c framework-tests
composer -d framework-tests remove codeception/module-symfony --dev --no-update
composer -d framework-tests install --no-progress
php framework-tests/bin/console doctrine:schema:update --force
php framework-tests/bin/console doctrine:fixtures:load --quiet
php vendor/bin/codecept run Functional -c framework-tests

if [ "${{ matrix.symfony }}" = "7.4" ]; then
composer require codeception/module-rest --dev
git -C framework-tests apply resetFormatsAfterRequest_issue_test.patch
composer -d framework-tests install --no-progress
php framework-tests/bin/console lexik:jwt:generate-keypair --skip-if-exists
php vendor/bin/codecept run Functional -c framework-tests
fi
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/vendor/
/composer.lock
/framework-tests
/.php-cs-fixer.cache
/.php-cs-fixer.cache
var/
26 changes: 26 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setRules([
'@PER-CS' => true,
'@PHP82Migration' => true,
'array_syntax' => ['syntax' => 'short'],
'strict_param' => true,
'declare_strict_types' => true,
])
->setFinder(
(new Finder())
->in(__DIR__)
->exclude(['var', 'vendor'])
->ignoreDotFiles(true)
->ignoreVCS(true)
)
;
89 changes: 53 additions & 36 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,58 @@
"require": {
"php": "^8.2",
"ext-json": "*",
"codeception/codeception": "^5.3",
"codeception/lib-innerbrowser": "^3.1 | ^4.0"
"codeception/lib-innerbrowser": "^3.1 | ^4.1"
},
"require-dev": {
"codeception/module-asserts": "^3.0",
"codeception/module-doctrine": "^3.1",
"doctrine/orm": "^3.5",
"friendsofphp/php-cs-fixer": "^3.85",
"codeception/module-asserts": "^3.3",
"codeception/module-doctrine": "^3.3",
"doctrine/orm": "^3.6",
"friendsofphp/php-cs-fixer": "^3.94",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^10.0",
"symfony/browser-kit": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/cache": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/config": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/dependency-injection": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/dom-crawler": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/dotenv": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/error-handler": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/filesystem": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/form": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/framework-bundle": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/http-client": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/http-foundation": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/http-kernel": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/mailer": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/mime": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/notifier": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/options-resolver": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/property-access": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/property-info": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/routing": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/security-bundle": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/security-core": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/security-csrf": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/security-http": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/translation": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/twig-bundle": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/validator": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"symfony/var-exporter": "^5.4 | ^6.4 | ^7.3 | ^8.0",
"vlucas/phpdotenv": "^4.2 | ^5.4"
"phpunit/phpunit": "^11.0 | ^12.0",
"symfony/browser-kit": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/cache": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/clock": "^6.4 | ^7.4 | ^8.0",
"symfony/config": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/console": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/css-selector": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/dependency-injection": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/dom-crawler": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/dotenv": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/error-handler": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/event-dispatcher": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/filesystem": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/finder": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/form": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/framework-bundle": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/http-client": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/http-foundation": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/http-kernel": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/mailer": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/mime": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/notifier": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/options-resolver": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/password-hasher": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/process": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/property-access": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/property-info": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/routing": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/security-bundle": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/security-core": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/security-csrf": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/security-http": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/stopwatch": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/string": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/translation": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/twig-bundle": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/validator": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/var-dumper": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"symfony/var-exporter": "^5.4 | ^6.4 | ^7.4",
"symfony/yaml": "^5.4 | ^6.4 | ^7.4 | ^8.0",
"vlucas/phpdotenv": "^4.2 | ^5.6"
},
"suggest": {
"codeception/codeception": "Install Codeception to run tests using this module",
"codeception/module-asserts": "Include traditional PHPUnit assertions in your tests",
"symfony/web-profiler-bundle": "Tool that gives information about the execution of requests"
},
Expand All @@ -73,6 +84,12 @@
"Codeception\\": "src/Codeception/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests",
"Tests\\App\\": "tests/_app"
}
},
"config": {
"sort-packages": true
},
Expand Down
Loading