Updated FlagBag. #418
This file contains 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: | |
workflow_dispatch: ~ | |
push: | |
branches: | |
- 2.x | |
pull_request: ~ | |
jobs: | |
lint: | |
name: Lint | |
runs-on: 'ubuntu-latest' | |
timeout-minutes: 5 | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v3 | |
- name: 'Setup PHP' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
coverage: none | |
- name: 'Require Doctrine MongoDB dependencies' | |
run: composer require --no-update --ignore-platform-reqs --dev --no-interaction --ansi "doctrine/mongodb-odm:^2.4" "doctrine/mongodb-odm-bundle:^4.5.1" | |
- name: 'Install dependencies' | |
id: deps | |
run: | | |
echo "::group::Install project deps" | |
composer update --prefer-dist --ignore-platform-reqs --ansi | |
echo "::endgroup::" | |
echo "::group::Install PHPUnit" | |
vendor/bin/simple-phpunit install | |
echo "::endgroup::" | |
env: | |
SYMFONY_REQUIRE: "6.2*dev" | |
- name: 'Lint - PHP CS Fixer' | |
if: always() && steps.deps.outcome == 'success' | |
run: | | |
echo "::group::Install PHP CS Fixer" | |
make php-cs-fixer.phar | |
echo "::endgroup::" | |
./php-cs-fixer.phar fix --dry-run --no-interaction --diff | |
- name: 'Lint - PHPStan' | |
if: always() && steps.deps.outcome == 'success' | |
run: ./vendor/bin/phpstan | |
test: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 15 | |
continue-on-error: ${{ matrix.allow-failure == 1 }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Lowest deps | |
- name: 'Test lowest deps [Linux, PHP 8.1]' | |
os: 'ubuntu-latest' | |
php: '8.1' | |
composer-flags: '--prefer-lowest' | |
allow-unstable: true | |
mongodb: true | |
# Previous Symfony versions | |
# … | |
# Previous PHP versions | |
# … | |
# Most recent versions | |
- name: 'Test Symfony 5.4 [Linux, PHP 8.1]' | |
os: 'ubuntu-latest' | |
php: '8.1' | |
symfony: '5.4.*@dev' | |
allow-unstable: true | |
mongodb: true | |
mysql: true | |
- name: 'Test Symfony 5.4 [Windows, PHP 8.1]' | |
os: 'windows-latest' | |
php: '8.1' | |
symfony: '5.4.*@dev' | |
mongodb: true | |
mysql: true | |
allow-unstable: true | |
- name: 'Test Symfony 6.0 [Linux, PHP 8.1]' | |
os: 'ubuntu-latest' | |
php: '8.1' | |
symfony: '6.0.*@dev' | |
mongodb: true | |
mysql: true | |
allow-unstable: true | |
- name: 'Test Symfony 6.1 [Linux, PHP 8.1]' | |
os: 'ubuntu-latest' | |
php: '8.1' | |
symfony: '6.1.*@dev' | |
allow-unstable: true | |
mysql: true | |
mongodb: true | |
- name: 'Test Symfony 6.2 [Linux, PHP 8.1]' | |
os: 'ubuntu-latest' | |
php: '8.1' | |
symfony: '6.2.*@dev' | |
allow-unstable: true | |
mysql: true | |
mongodb: true | |
# 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: '6.3.*@dev' | |
composer-flags: '--ignore-platform-req php' | |
allow-unstable: true | |
allow-failure: true | |
mysql: true | |
mongodb: true | |
- name: 'Test next Symfony [Linux, PHP 8.2] (allowed failure)' | |
os: 'ubuntu-latest' | |
php: '8.2' | |
symfony: '6.3.*@dev' | |
composer-flags: '--ignore-platform-req php' | |
allow-unstable: true | |
allow-failure: true | |
mysql: true | |
mongodb: true | |
- name: 'Test next Symfony [Linux, PHP 8.3] (allowed failure)' | |
os: 'ubuntu-latest' | |
php: '8.3' | |
symfony: '6.3.*@dev' | |
composer-flags: '--ignore-platform-req php' | |
allow-unstable: true | |
allow-failure: true | |
mysql: true | |
mongodb: 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@v3 | |
- name: 'Setup PHP' | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: pdo_sqlite ${{ matrix.mongodb && ', mongodb' }} ${{ matrix.mysql && ', pdo_mysql' }} | |
coverage: none | |
tools: 'composer:v2,flex' | |
- name: 'Start MongoDB (Linux)' | |
uses: supercharge/[email protected] | |
if: ${{ matrix.mongodb && matrix.os == 'ubuntu-latest' }} | |
- name: 'Remove MongoDB (Windows)' | |
uses: crazy-max/ghaction-chocolatey@v2 | |
with: | |
args: uninstall mongodb mongodb.install -y --all-versions | |
if: ${{ matrix.mongodb && matrix.os == 'windows-latest' }} | |
- name: 'Start MongoDB (Windows)' | |
uses: crazy-max/ghaction-chocolatey@v2 | |
with: | |
args: install mongodb.install --version=5.0.14 --allow-downgrade | |
if: ${{ matrix.mongodb && matrix.os == 'windows-latest' }} | |
- name: 'Shutdown Default Ubuntu MySQL' | |
run: sudo service mysql stop | |
if: ${{ matrix.mysql && matrix.os == 'ubuntu-latest' }} | |
- name: 'Setup MySQL' | |
uses: ankane/setup-mysql@v1 | |
with: | |
mysql-version: '8.0' | |
database: doctrine_tests | |
if: ${{ matrix.mysql }} | |
- name: 'Get composer cache directory' | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
if: ${{ matrix.os != 'windows-latest' }} | |
- name: 'Cache dependencies' | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-${{ hashFiles('**/composer.json') }}-flags-${{ matrix.composer-flags }} | |
restore-keys: ${{ runner.os }}-composer- | |
if: ${{ matrix.os != 'windows-latest' }} | |
- name: 'Allow unstable packages' | |
run: composer config minimum-stability dev | |
if: ${{ matrix.allow-unstable }} | |
- name: 'Require Doctrine MongoDB dependencies' | |
run: composer require --no-update ${{ matrix.composer-flags }} --dev --no-interaction --ansi "doctrine/mongodb-odm:^2.4" "doctrine/mongodb-odm-bundle:^4.5.1" | |
if: ${{ matrix.mongodb }} | |
- name: 'Install dependencies' | |
run: | | |
echo "::group::Install project deps" | |
composer update --prefer-dist ${{ matrix.composer-flags }} --ansi | |
echo "::endgroup::" | |
echo "::group::Install PHPUnit" | |
vendor/bin/simple-phpunit install | |
echo "::endgroup::" | |
env: | |
SYMFONY_REQUIRE: "${{ matrix.symfony }}" | |
- name: 'Set Doctrine MySQL DSN (Linux)' | |
run: echo "DOCTRINE_DBAL_URL=pdo-mysql://[email protected]:3306/doctrine_tests?serverVersion=8.0" >> $GITHUB_ENV | |
if: ${{ matrix.mysql && matrix.os == 'ubuntu-latest' }} | |
- name: 'Set Doctrine MySQL DSN (Windows)' | |
run: echo "DOCTRINE_DBAL_URL=pdo-mysql://[email protected]:3306/doctrine_tests?serverVersion=8.0" >> $env:GITHUB_ENV | |
if: ${{ matrix.mysql && matrix.os == 'windows-latest' }} | |
- name: 'Run PHPUnit tests' | |
run: vendor/bin/simple-phpunit --testdox --verbose |