diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..17a17341 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,132 @@ +name: CI + +on: + push: + branches: + - master + pull_request: ~ + +jobs: + + lint: + name: Lint + runs-on: 'ubuntu-latest' + timeout-minutes: 5 + + steps: + - name: 'Checkout' + uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + + - 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@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: 'Install dependencies' + run: composer update --prefer-dist + + - name: 'Check style' + run: vendor/bin/php-cs-fixer fix --dry-run --no-interaction --diff + + test: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + timeout-minutes: 8 + continue-on-error: ${{ matrix.allow-failure == 1 }} + + strategy: + fail-fast: false + matrix: + include: + # Previous Symfony versions & lowest deps + - name: 'Test lowest deps [Linux, PHP 7.3]' + os: 'ubuntu-latest' + php: '7.3' + composer-flags: '--prefer-lowest' + + # Previous Symfony versions + - name: 'Test 5.2 Symfony [Linux, PHP 8.0]' + os: 'ubuntu-latest' + symfony-version: '5.2.x' + php: '8.0' + + # Previous PHP versions + - name: 'Test latest Symfony [Linux, PHP 7.3]' + os: 'ubuntu-latest' + php: '7.3' + composer-flags: '--prefer-lowest' + + - name: 'Test latest Symfony [Linux, PHP 7.4]' + os: 'ubuntu-latest' + php: '7.4' + + # Most recent versions + - name: 'Test latest Symfony [Linux, PHP 8.0] (with code coverage)' + os: 'ubuntu-latest' + php: '8.0' + code-coverage: true + + - name: 'Test latest Symfony [Window, PHP 8.0]' + os: 'windows-latest' + php: '8.0' + + # bleeding edge (unreleased dev versions where failures are allowed) + - name: 'Test Next Symfony [Linux, PHP 8.1] (allowed failure)' + os: 'ubuntu-latest' + php: '8.1' + symfony-version: '^5.4' + composer-flags: '--ignore-platform-req php' + allow-unstable: true + allow-failure: true + + steps: + - name: 'Set git to use LF' + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: 'Checkout' + uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: pcov + extensions: pdo_sqlite + + - 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@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: 'Allow unstable packages' + run: composer config prefer-stable false + if: ${{ matrix.allow-unstable }} + + - name: 'Lock Symfony version' + run: composer require "symfony/symfony:${{ matrix.symfony-version }}" --no-update + if: ${{ matrix.symfony-version != '' }} + + - name: 'Install dependencies' + run: composer update --prefer-dist ${{ matrix.composer-flags }} + + - name: 'Run PHPUnit tests' + run: vendor/bin/simple-phpunit ${{ matrix.code-coverage && '--coverage-text --coverage-clover build/logs/clover.xml' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index bc1eba16..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Tests - -on: - push: - branches: - - master - pull_request: -jobs: - test: - name: PHP ${{ matrix.php }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.php == '8.1' }} - - strategy: - matrix: - include: - - os: 'ubuntu-latest' - php: '7.3' - composer-flags: '--prefer-lowest' - - os: 'ubuntu-latest' - php: '7.4' - check-cs: true - - os: 'ubuntu-latest' - php: '8.0' - - os: 'windows-latest' - php: '8.0' - - os: 'ubuntu-latest' - php: '8.1' - symfony-version: '^5.3' - composer-flags: '--ignore-platform-req php' - allow-unstable: true - fail-fast: false - steps: - - name: Set git to use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: pcov - extensions: pdo_sqlite - - - 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@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Allow unstable packages - run: composer config prefer-stable false - if: ${{ matrix.allow-unstable }} - - - name: Lock Symfony version - run: composer require "symfony/symfony:${{ matrix.symfony-version }}" --no-update - if: ${{ matrix.symfony-version != '' }} - - - name: Install dependencies - run: composer update --prefer-dist ${{ matrix.composer-flags }} - - - name: Run PHPUnit tests - run: vendor/bin/simple-phpunit --coverage-text --coverage-clover build/logs/clover.xml - - - name: Check style - run: vendor/bin/php-cs-fixer fix --dry-run --no-interaction --diff - if: ${{ matrix.check-cs }} diff --git a/Makefile b/Makefile index a26f6dd0..04fed6c1 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ ########### install: + composer remove --dev "symfony/symfony" # Require "phpspec/prophecy" for PHPUnit 9 used when PHP 8+ is used php -r "exit (PHP_MAJOR_VERSION == 8 ? 0 : 1);" \ && composer config platform.php 7.4.99 \ @@ -10,11 +11,11 @@ install: composer update install-lowest: - composer require "symfony/symfony:^4.4" --no-update --no-interaction --dev + composer require "symfony/symfony:4.4.x" --no-update --no-interaction --dev composer update --prefer-lowest install-highest: - composer require "symfony/symfony:^5.3" --no-update --no-interaction --dev + composer require "symfony/symfony:5.4.x" --no-update --no-interaction --dev composer update ######## diff --git a/README.md b/README.md index 4cfafce2..a7a32e51 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Elao Enumerations [![Latest Stable Version](https://poser.pugx.org/elao/enum/v/stable?format=flat-square)](https://packagist.org/packages/elao/enum) [![Total Downloads](https://poser.pugx.org/elao/enum/downloads?format=flat-square)](https://packagist.org/packages/elao/enum) [![Monthly Downloads](https://poser.pugx.org/elao/enum/d/monthly?format=flat-square)](https://packagist.org/packages/elao/enum) -[![Tests](https://github.com/Elao/PhpEnums/actions/workflows/tests.yml/badge.svg)](https://github.com/Elao/PhpEnums/actions/workflows/tests.yml) +[![Tests](https://github.com/Elao/PhpEnums/actions/workflows/ci.yml/badge.svg)](https://github.com/Elao/PhpEnums/actions/workflows/ci.yml) [![Coveralls](https://img.shields.io/coveralls/Elao/PhpEnums.svg?style=flat-square)](https://coveralls.io/github/Elao/PhpEnums) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Elao/PhpEnums.svg?style=flat-square)](https://scrutinizer-ci.com/g/Elao/PhpEnums/?branch=master) [![php](https://img.shields.io/badge/PHP-7.3-green.svg?style=flat-square "Available for PHP 7.3+")](http://php.net) diff --git a/composer.json b/composer.json index 13b42bd5..6bce15bb 100644 --- a/composer.json +++ b/composer.json @@ -55,9 +55,8 @@ "symfony/css-selector": "^4.4|^5.1", "symfony/form": "^4.4|^5.1", "symfony/framework-bundle": "^4.4|^5.1", - "symfony/phpunit-bridge": "^5.3.0-RC1", + "symfony/phpunit-bridge": "^5.3", "symfony/serializer": "^4.4|^5.1", - "symfony/symfony": "^4.4", "symfony/translation": "^4.4|^5.1", "symfony/twig-bundle": "^4.4|^5.1", "symfony/validator": "^4.4|^5.1", diff --git a/tests/Fixtures/Integration/Symfony/config/config.yml b/tests/Fixtures/Integration/Symfony/config/config.yml index ec4978dc..41e06a66 100644 --- a/tests/Fixtures/Integration/Symfony/config/config.yml +++ b/tests/Fixtures/Integration/Symfony/config/config.yml @@ -6,8 +6,6 @@ framework: strict_requirements: '%kernel.debug%' utf8: true test: ~ - session: - storage_id: 'session.storage.mock_file' assets: false twig: diff --git a/tests/Fixtures/Integration/Symfony/config/config_5.3.0.yml b/tests/Fixtures/Integration/Symfony/config/config_5.3.0.yml new file mode 100644 index 00000000..285427a9 --- /dev/null +++ b/tests/Fixtures/Integration/Symfony/config/config_5.3.0.yml @@ -0,0 +1,3 @@ +framework: + session: + storage_factory_id: 'session.storage.factory.mock_file' diff --git a/tests/Fixtures/Integration/Symfony/config/config_prev_5.3.0.yml b/tests/Fixtures/Integration/Symfony/config/config_prev_5.3.0.yml new file mode 100644 index 00000000..61244760 --- /dev/null +++ b/tests/Fixtures/Integration/Symfony/config/config_prev_5.3.0.yml @@ -0,0 +1,3 @@ +framework: + session: + storage_id: 'session.storage.mock_file' diff --git a/tests/Fixtures/Integration/Symfony/src/AppKernel.php b/tests/Fixtures/Integration/Symfony/src/AppKernel.php index 35415680..811a90b3 100644 --- a/tests/Fixtures/Integration/Symfony/src/AppKernel.php +++ b/tests/Fixtures/Integration/Symfony/src/AppKernel.php @@ -33,6 +33,12 @@ public function registerBundles() public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load($this->getProjectDir() . '/config/config.yml'); + + if (self::VERSION_ID < 50300) { + $loader->load($this->getProjectDir() . '/config/config_prev_5.3.0.yml'); + } else { + $loader->load($this->getProjectDir() . '/config/config_5.3.0.yml'); + } } public function getProjectDir()