Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,93 @@ jobs:
# uses: codecov/codecov-action@v4
# with:
# files: build/logs/clover.xml

migrations:
name: Migrations ${{ matrix.database }} + DBAL ${{ matrix.dbal }}
runs-on: ubuntu-latest
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-require }}
DATABASE_URL: ${{ matrix.database-url }}

strategy:
fail-fast: false
matrix:
database: [mysql, mariadb, postgresql]
dbal: ['3', '4']
include:
- database: mysql
image: mysql:8.4
port: 3306
health-cmd: mysqladmin ping -h 127.0.0.1
database-url: mysql://app:app@127.0.0.1:3306/app?serverVersion=8.4.0
- database: mariadb
image: mariadb:11.4
port: 3306
health-cmd: healthcheck.sh --connect --innodb_initialized
database-url: mysql://app:app@127.0.0.1:3306/app?serverVersion=11.4.0-MariaDB
- database: postgresql
image: postgres:17
port: 5432
health-cmd: pg_isready -U app
database-url: postgresql://app:app@127.0.0.1:5432/app?serverVersion=17&charset=utf8
- dbal: '3'
php-version: '8.4'
symfony-require: 7.4.*
- dbal: '4'
php-version: '8.5'
symfony-require: ''

services:
database:
image: ${{ matrix.image }}
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: app
MYSQL_USER: app
MYSQL_PASSWORD: app
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: app
MARIADB_USER: app
MARIADB_PASSWORD: app
POSTGRES_DB: app
POSTGRES_USER: app
POSTGRES_PASSWORD: app
ports:
- ${{ matrix.port }}:${{ matrix.port }}
options: >-
--health-cmd "${{ matrix.health-cmd }}"
--health-interval 5s
--health-timeout 5s
--health-retries 20

steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: pdo_mysql, pdo_pgsql
coverage: none
tools: composer:v2, flex
- name: Require DBAL 3
if: matrix.dbal == '3'
run: composer require doctrine/dbal:^3.10 --no-update
- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
dependency-versions: highest
- name: Run the migrations
run: tests/App/bin/console doctrine:migrations:migrate --no-interaction
# DBAL 3 does not read the PostgreSQL identity columns created by the migrations (it expects sequences): the
# schema is always reported as out of sync, inserts work (the ORM uses the sequence of the identity column)
- name: Validate the schema
if: matrix.dbal != '3' || matrix.database != 'postgresql'
run: tests/App/bin/console doctrine:schema:validate
- name: Revert the migrations
run: tests/App/bin/console doctrine:migrations:migrate first --no-interaction
- name: Run the migrations again
run: tests/App/bin/console doctrine:migrations:migrate --no-interaction
- name: Validate the schema again
if: matrix.dbal != '3' || matrix.database != 'postgresql'
run: tests/App/bin/console doctrine:schema:validate
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Latest
* [#83](https://github.com/cleverage/ui-process-bundle/issues/83) Remove `UploadAndExecuteAction` (route `process_upload_and_execute`), `ProcessUploadFileType` and `ProcessConfigurationValueResolver`: the action was broken and unreachable, file uploads are handled by `LaunchAction` (`entrypoint_type: file`).
* [#84](https://github.com/cleverage/ui-process-bundle/issues/84) Add `LogRecord::hasContextInfo()`, deprecate the misnamed `LogRecord::contextIsEmpty()` (it returns `true` when the context is not empty). Add tests.
* [#85](https://github.com/cleverage/ui-process-bundle/issues/85) `ProcessHandler`: default report increment level aligned on the bundle configuration (`Warning`); declare the `symfony/ux-twig-component` dependency. Add tests.
* [#129](https://github.com/cleverage/ui-process-bundle/issues/129) CI: `migrations` job running the migrations on MySQL, MariaDB and PostgreSQL, with DBAL 3 and 4 (`migrate`, `doctrine:schema:validate`, `migrate first`, `migrate` again); console of the test application (`tests/App/bin/console`), database URL overridable with `DATABASE_URL` (SQLite by default).

## Fixes
* [#89](https://github.com/cleverage/ui-process-bundle/issues/89) `ProcessConfigurationsManager`: resolve the `ui.default` option with a normalizer instead of nested options defined with `setDefault()` (deprecated since symfony/options-resolver 7.3, removed in 8.0). With Symfony 8, a process launched with the UI form (`ui_launch_mode: form`) without `ui.default` no longer fails (`Cannot use object of type Closure as array`), and `ui.default` is validated again. Add tests.
Expand Down
21 changes: 21 additions & 0 deletions tests/App/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

/*
* This file is part of the CleverAge/UiProcessBundle package.
*
* Copyright (c) Clever-Age
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use CleverAge\UiProcessBundle\Tests\App\TestKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

// Console of the test application, used by the CI to run the migrations (DATABASE_URL)
require dirname(__DIR__, 3).'/vendor/autoload.php';

exit((new Application(new TestKernel('test', true)))->run());
4 changes: 3 additions & 1 deletion tests/App/config/packages.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
parameters:
upload_directory: '%kernel.cache_dir%/uploads'
# SQLite by default; the CI runs the migrations on MySQL / MariaDB / PostgreSQL with DATABASE_URL
env(DATABASE_URL): 'sqlite:///%kernel.cache_dir%/test.db'

framework:
secret: 'test'
Expand All @@ -26,7 +28,7 @@ security:

doctrine:
dbal:
url: 'sqlite:///%kernel.cache_dir%/test.db'
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_mapping: true
# As the Symfony recipe: the indexes of the bundle entities use snake_case column names
Expand Down
Loading