diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 2d3bc563..ef9f7626 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -1,10 +1,11 @@ -name: CI +name: Backend CI on: push: branches: - '[0-9]+.[0-9]+' pull_request: ~ + workflow_dispatch: ~ jobs: cs-fix: @@ -19,38 +20,17 @@ jobs: - uses: ibexa/gh-workflows/actions/composer-install@main with: + php-version: ${{ matrix.php }} gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - name: Run code style check - run: composer run-script check-cs -- --format=checkstyle | cs2pr - - rector: - name: Run rector - runs-on: "ubuntu-24.04" - strategy: - matrix: - php: - - '8.3' - steps: - - uses: actions/checkout@v6 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: 'pdo_sqlite, gd' - tools: cs2pr - - - uses: ramsey/composer-install@v3 - with: - dependency-versions: highest - - - name: Run rector - run: vendor/bin/rector process --dry-run --ansi + shell: bash + run: | + set -euo pipefail + composer run-script check-cs -- --format=checkstyle | cs2pr tests: name: Unit tests & SQLite integration tests @@ -69,6 +49,7 @@ jobs: - uses: ibexa/gh-workflows/actions/composer-install@main with: + php-version: ${{ matrix.php }} gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} diff --git a/.github/workflows/browser-tests.yaml b/.github/workflows/browser-tests.yaml index 687cff07..668a8290 100644 --- a/.github/workflows/browser-tests.yaml +++ b/.github/workflows/browser-tests.yaml @@ -3,7 +3,6 @@ name: Browser tests on: push: branches: - - main - '[0-9]+.[0-9]+' pull_request: ~ diff --git a/.github/workflows/pr-assign.yaml b/.github/workflows/pr-assign.yaml deleted file mode 100644 index 302423e3..00000000 --- a/.github/workflows/pr-assign.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: Assign Pull Request to maintainers - -on: - pull_request_target: - -jobs: - assign: - uses: ibexa/gh-workflows/.github/workflows/pr-assign.yml@main - secrets: - robot-token: ${{ secrets.EZROBOT_PAT }} diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml new file mode 100644 index 00000000..804802ae --- /dev/null +++ b/.github/workflows/rector.yaml @@ -0,0 +1,17 @@ +name: Rector PHP +on: + push: + branches: + - '[0-9]+.[0-9]+' + pull_request: ~ +jobs: + rector: + name: Run rector + uses: ibexa/gh-workflows/.github/workflows/rector.yml@main + with: + php-version: '8.3' + secrets: + AUTOMATION_CLIENT_ID: ${{ secrets.AUTOMATION_CLIENT_ID }} + AUTOMATION_CLIENT_SECRET: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + SATIS_NETWORK_KEY: ${{ secrets.SATIS_NETWORK_KEY }} + SATIS_NETWORK_TOKEN: ${{ secrets.SATIS_NETWORK_TOKEN }} diff --git a/composer.json b/composer.json index 9caff30a..83d6749f 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,7 @@ "ibexa/rector": "~5.0.x-dev", "ibexa/rest": "~5.0.x-dev", "ibexa/search": "~5.0.x-dev", + "ibexa/test-core": "~5.0.x-dev", "matthiasnoback/symfony-dependency-injection-test": "^5.0", "phpstan/phpstan": "^2.0", "phpstan/phpstan-phpunit": "^2.0", diff --git a/tests/bootstrap.php b/tests/bootstrap.php index eff8e4e8..fdfee57d 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,35 +6,10 @@ */ declare(strict_types=1); -use Ibexa\Contracts\Core\Test\Persistence\Fixture\FixtureImporter; -use Ibexa\Tests\Core\Repository\LegacySchemaImporter; -use Ibexa\Tests\Integration\User\IbexaTestKernel; -use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArrayInput; +use Ibexa\Contracts\Test\Core\Bootstrapper\Bootstrapper; require dirname(__DIR__) . '/vendor/autoload.php'; chdir(__DIR__ . '/..'); -$kernel = new IbexaTestKernel('test', true); -$kernel->boot(); - -$application = new Application($kernel); -$application->setAutoExit(false); - -$application->run(new ArrayInput([ - 'command' => 'doctrine:database:create', -])); - -/** @var \Psr\Container\ContainerInterface $testContainer */ -$testContainer = $kernel->getContainer()->get('test.service_container'); - -$schemaImporter = $testContainer->get(LegacySchemaImporter::class); -foreach ($kernel->getSchemaFiles() as $file) { - $schemaImporter->importSchema($file); -} - -$fixtureImporter = $testContainer->get(FixtureImporter::class); -foreach ($kernel->getFixtures() as $fixture) { - $fixtureImporter->import($fixture); -} +(new Bootstrapper())->bootstrap(); diff --git a/tests/integration/IbexaTestKernel.php b/tests/integration/IbexaTestKernel.php index d328e521..c816d7cd 100644 --- a/tests/integration/IbexaTestKernel.php +++ b/tests/integration/IbexaTestKernel.php @@ -10,9 +10,10 @@ use Ibexa\Bundle\ContentForms\IbexaContentFormsBundle; use Ibexa\Bundle\Notifications\IbexaNotificationsBundle; +use Ibexa\Bundle\Test\Core\IbexaTestCoreBundle; use Ibexa\Bundle\User\IbexaUserBundle; use Ibexa\ContentForms\Form\ActionDispatcher\UserDispatcher; -use Ibexa\Contracts\Core\Test\IbexaTestKernel as BaseIbexaTestKernel; +use Ibexa\Contracts\Test\Core\IbexaTestKernel as BaseIbexaTestKernel; use Ibexa\Contracts\User\Invitation\InvitationService; use LogicException; use Symfony\Component\Config\Loader\LoaderInterface; @@ -22,21 +23,13 @@ final class IbexaTestKernel extends BaseIbexaTestKernel { - #[\Override] - public function getSchemaFiles(): iterable - { - yield from parent::getSchemaFiles(); - - yield from [ - $this->locateResource('@IbexaUserBundle/Resources/config/storage/schema.yaml'), - ]; - } - #[\Override] public function registerBundles(): iterable { yield from parent::registerBundles(); + yield new IbexaTestCoreBundle(); + yield from [ new IbexaUserBundle(), new IbexaNotificationsBundle(),