diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e33e9b2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + # See https://symfony.com/releases & https://www.php.net/supported-versions.php + - php-version: '8.2' + symfony-version: '^7.0' + - php-version: '8.3' + symfony-version: '^7.0' + - php-version: '8.4' + symfony-version: '^7.0' + - php-version: '8.4' + symfony-version: '^8.0' + - php-version: '8.5' + symfony-version: '^7.0' + - php-version: '8.5' + symfony-version: '^8.0' + + name: "PHPUnit tests, PHP version ${{ matrix.php-version }} - Symfony Version: ${{matrix.symfony-version}}" + steps: + - uses: actions/checkout@v6 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: | + ~/.composer/cache + vendor + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + composer-${{ runner.os }}-${{ matrix.php-version }}- + + - name: Install specific symfony version + run: composer require symfony/console:${{matrix.symfony-version}} symfony/dependency-injection:${{matrix.symfony-version}} -W + + - name: Run PHPUnit + run: vendor/bin/phpunit -v diff --git a/.github/workflows/symfony-beta-ci.yml b/.github/workflows/symfony-beta-ci.yml new file mode 100644 index 0000000..52970a3 --- /dev/null +++ b/.github/workflows/symfony-beta-ci.yml @@ -0,0 +1,45 @@ +name: "Run Symfony beta version(s)" +description: Runs on the latest beta version so that any breaking changes can be known about a bit in advanced. +on: + schedule: + - cron: "0 7 1 * *" + +jobs: + test-beta: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - php-version: '8.4' + symfony-version: '^8.1' + - php-version: '8.5' + symfony-version: '^8.1' + + name: "PHPUnit tests, PHP version ${{ matrix.php-version }} - Symfony Version: ${{matrix.symfony-version}}" + steps: + - uses: actions/checkout@v6 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: | + ~/.composer/cache + vendor + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + composer-${{ runner.os }}-${{ matrix.php-version }}- + + - name: Allow beta/dev versions of packages + run: composer config minimum-stability dev + + - name: Install specific symfony version + run: composer require symfony/console:${{matrix.symfony-version}} symfony/dependency-injection:${{matrix.symfony-version}} -W + + - name: Run PHPUnit + run: vendor/bin/phpunit -v diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dd175c0..84bbbdd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,8 @@ - - +add($command); + + if (method_exists($application, 'addCommand')) { + $application->addCommand($command); + } else { + // FIXME: Once symfony/console:8.0 is the minimum required version we can drop the add + $application->add($command); + } + $application->setAutoExit(false); $input = new ArrayInput([