Standardize to PHP 8.2 and PSR-4 #703
Workflow file for this run
This file contains hidden or 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: CI | |
on: [push, pull_request] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.2, 8.3, 8.4] | |
symfony: ["5.4.*", "6.4.*", "6.4wApi", "7.3.*"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer:v2 | |
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite | |
coverage: none | |
- 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 | |
- name: Checkout Symfony ${{ env.SF_REF }} sample | |
uses: actions/checkout@v4 | |
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 | |
- 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: ${{ matrix.symfony == '7.3.*' }} | |
run: composer phpstan | |
- name: Run PHP-CS-Fixer | |
if: ${{ matrix.symfony == '7.3.*' }} | |
run: composer cs-check | |
- 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 | |
- name: Setup Database | |
run: | | |
php bin/console doctrine:schema:update --force | |
php bin/console doctrine:fixtures:load --quiet | |
working-directory: framework-tests | |
- 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 tests | |
run: | | |
php vendor/bin/codecept build -c framework-tests | |
php vendor/bin/codecept run Functional -c framework-tests |